MongoDB is a document database that stores JSON-like documents (called BSON ). The maximum size of a BSON object is 16 megabytes , which may be too small for some use cases.
If you want to store binary data of arbitrary size, you can use GridFS ( http://www.mongodb.org/display/DOCS/GridFS+Specification ). GridFS automatically splits your documents (or any binary data) into several BSON objects ( usually 256k in size ), so you only need to worry about storing and retrieving complete documents (regardless of their size).
As far as I know, Mongoose does not support GridFS. However, you can use GridFS through the native GridStore driver . Just run npm install mongodb
and start hacking!
source share