0 votes
1 view
in SQL by (47.8k points)

How can I store images in a MongoDB database rather than just text? Can I create an array of images in a MongoDB database? Will it be possible to do the same for videos?

2 Answers

0 votes
by (107k points)

You can have a look at the GridFS docs which is used for storing binary data like images and all.

0 votes
by (92.1k points)

MongoDB BSON documents are capped at 16 MB. So if the entire size of your array of files is less than that, you may save them directly in your document using the BinData data type.

Videos, images, PDFs, spreadsheets, etc. - it doesn't matter, they are all handled the same. It's up to your application to return a suitable content-type header to display them.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !