Storing images in MongoDB

hello community! i am new to MongoDB, i wanna know if mongodb is good for storing images and how i can store images in mongodb. I am using Node, Express framework and reactjs. Pls i need a perfect tutorial on how i can work with images. Thanks a bunch.

1 Like

Look at

1 Like

No, MongoDB is not a good place for storing files. If you want to store files, you should use storages like Amazon S3 or Google Could Storage.

The good practice is to store the files in a storage and then to just save the URL of the uploaded image in the MongoDB.

When it comes to Node.js and Express, I would suggest multer package middleware, which is primarily used for uploading files. If you would use Amazon S3 for a storage, there is also a plug-in multer-s3 package that can be helpful.

You can check this video on how to configure Multer and implement image upload on your Node.js server. Once the image is uploaded, Multer will return data to you with destination field included. You can then save that destination in the MongoDB.


i am very grateful. I hope it solves my problem.

1 Like