Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (47.6k 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 (106k points)

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

0 votes
by (107k 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

0 votes
0 answers
0 votes
3 answers
0 votes
1 answer
0 votes
0 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...