I have been told MongoDB uses the GridFS filesystem for storing files. However, Is there any way to store the file themselves in the database BSON structure by serializing or base64 encoding ?
Thanks and appreciate any help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure, you can serialize your file as string and store it in document field. But in such approach there is one downside – all your files should < then 16 mb (size limit of one document).
Mongodb gridfs build on top of mongodb collections, and contains two collections:
You can check here how file looks like in mongodb.
So, if you decided to store files in mongodb it is better to use common, tested by community approach – gridfs.