Using MongoDB for storing PDF (or any binary) files


From the lecture it is mentioned that there is a limit of 16MB on documents saved in MongoDB. So, does it means that MongoDB will not be suitable for storing binary content (like saving pdf file or doc file)?


If the file is smaller you probably could.

Personally, I would not store file in a database like that. I would you aws s3 or other CDN.

Thanks @steevej-1495. As you said, better approach would be to store documents separately in a CDN.

I did some more search on this topic and find these links on how binary byte array can be saved in MongoDB.

Support for binary objects

Thanks for the link. It will be added to my MUST-READ list.