DON't USE MongoDB For This

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Literally I just started a new project in MongoDb and this thumbnail pops up in my subscription... Wtf😂

erenackerman
Автор

You can use express-fileupload library and you can save images in your backend as a link that can be used in any front end

shantanu
Автор

I went tru thesame thing. I lost a whole week trying to convert binary data from mongodb to image. I think the best solution is to use gridFS.

lekkyjayz
Автор

This hat nothing to do with mongodb it is an architecture decision. I don't know many case where it make sense to save image in the db directly. Better way is just to save it some custom storage service like firebase/Azure/... storage and save the link of the image in your db. Independently of which one you're using NoSQL or not.

Another point is that with images in the dB your query will become very slow. It will also cost you too much more to load and send images everytime. So my advice is use the right tool for the right job.

jude_
Автор

Brooo I think you can convert your image to base64URL and then store it as string in MongoDB

mohmedishak