Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

511
Vistas
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

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

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

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda