Implementing a GridFS Store

Occasionally you might want to use MongoDB to store and retrieve data that exceeds the 16MB size limit (for example, if you are storing large images, zip files, movies, etc.). To accommodate this, MongoDB provides the GridFS framework. GridFS splits large documents into chunks. The chunks are stored in one collection, and metadata that is used to access the documents is stored in another collection.

When you query GridFS for a document, the chunks are reassembled and sent back just as any other document. A great feature of GridFS is that by using skip, you can read from the middle of a document without needing to load the entire document from disk. This allows you to read chunks of large files without running the risk of out-of-memory conditions.

You can implement GridFS either from the MongoDB shell or by using the MongoDB Node.js driver. The MongoDB Node.js driver provides the Grid and GridStore objects, which allow you to interact with the MongoDB GridFS

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.200.164