MongoDB GridFS Files and Chunks - OmIndia

Teach To India

Friday, August 03, 2018

MongoDB GridFS Files and Chunks

MongoDB GridFS Files and Chunks

GridFS is the MongoDB specification for storing and retrieving large files such as images, audio files, video files, etc. It is kind of a file system to store files but its data is stored within MongoDB collections. GridFS has the capability to store files even greater than its document size limit of 16MB. 





GridFS divides a file into chunks and stores each chunk of data in a separate document, each of maximum size 255k. 






GridFS by default uses two collections fs.files and fs.chunks to store the file's metadata and the chunks. Each chunk is identified by its unique _id ObjectId field. The fs.files serves as a parent document. The files_id field in the fs.chunks document links the chunk to its parent.
 

No comments:

Post a Comment

Comments

Popular