June 2014
Intermediate to advanced
696 pages
38h 52m
English
The GridStore object acts as a representation of a binary file stored in the MongoDB GridFS. It provides the basic file interface to read and write files stored in GridFS. For example, you can stream reads and writes from GridFS, read chunks of a file without needing to read the entire file, etc. These are all things that you could do within Node.js, but without the added benefits that come with MongoDB, such as replication and high availability.
You can instantiate the GridStore object by calling the GridStore() constructor from an instance of the Db object. For example, the following code connects to MongoDB and creates a GridStore object attached to the fs collection:
Read now
Unlock full access