|
GridFS is a specification for storing large files in MongoDB. All of the officially supported driver implement the GridFS spec. RationaleThe database supports native storage of binary data within BSON objects. However, BSON objects in MongoDB are limited to 4MB in size. The GridFS spec provides a mechanism for transparently dividing a large file among multiple documents. This allows us to efficiently store large objects, and in the case of especially large files, such as videos, permits range operations (e.g., fetching only the first N bytes of a file). ImplementationTo facilitate this, a standard is specified for the chunking of files. Each file has a metadata object in a files collection, and one or more chunk objects in a chunks collection. Details of how this is stored can be found in the GridFS Specification; however, you do not really need to read that, instead, just look at the GridFS API in each language's client driver or mongofiles tool. Language SupportMost drivers include GridFS implementations; for languages not listed below, check the driver's API documentation. (If a language does not include support, see the GridFS specification -- implementing a handler is usually quite easy.) Command Line ToolsCommand line tools are available to write and read GridFS files from and to the local filesystem. See also |

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.
blog comments powered by Disqus