Home > Software design >  Best way to uplaod image in mongodb
Best way to uplaod image in mongodb

Time:07-04

Hello I have a project and for this project I have to store images here of cocktails, so I have defined what a cocktail is so for my project it's a name, a list of ingredients if it contains alcohol and an image and here is my problem how can I store my cocktail object so I did my research and I saw that we could store images in mongodb but I don't know if it's the best solution or how to do it.

Thank you for your help.

CodePudding user response:

You can store images in mongoDB up to 16MB ( max document size hard coded limit in mongoDB) , or if the images are bigger you can store them using the gridFS API But for bigger projects best practice is to store your doucments in mongoDB and if you have pictures , attachment , or other big files that are expected to be used as files to store them in distributed object storage like AWS S3 and keep just the references in the master document storeed in mongoDB.

  • Related