GridFS used to store and restore those files over 16M (BSON file limit) of (such as: images, audio, video, etc.).
One way GridFS file is stored, but it is in the collection is stored in MonoDB.
GridFS can better storage of files larger than 16M. GridFS will big object into a plurality of small chunk (file fragment), typically 256k / a, as each chunk of a document MongoDB (document) are stored in a set of chunks.
GridFS two collection to store a file: fs.files and fs.chunks.
The actual contents of each file is exist in chunks (binary data), meta data and documents related to the (filename, content_type, as well as user-defined attributes) will be the presence of files in the collection.
The following is a simple fs.files collection of documents:
{
"filename": "test.txt", "chunkSize": NumberInt(261120), "uploadDate": ISODate("2014-04-13T11:32:33.557Z"), "md5": "7b762939321e146569b07f72c62cca4f", "length": NumberInt(646) }
The following is a simple fs.chunks collection of documents:
{
"files_id": ObjectId("534a75d19f54bfec8a2fe44b"), "n": NumberInt(0), "data": "Mongo Binary Data" }