Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

287
Visualizações
Add image to mongodb with mongoose

i am new to the MEAN steak and i am tryingto upload a file from my computer to my project and in the mongoDb databse. I don't need to use gridFs from mongo because my images are much smaller. Can someone give me an example, or tell me what's the logic.

Tannk you, Adrian

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It is not suggested to store images in a database, because you have performance issues when pulling long strings... The suggested solution is something like s3 from Amazon which stores the actual files, but since your question is how to store an image in mongodb here is what you need to know.

This is stored as a dataUrl aka a freakishly long string not entirely ideal for sending in Json responses. You will need to convert the image to a base64 representation of the image and here is a link to an explanation of your stored string format.

How to implement -toDataURL() function in node.js server?

Here is a link on converting an image to base64 using node.js

NodeJS base64 image encoding/decoding not quite working

If this answers your question please mark this as the best answer

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda