Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!