How can I store images in mongodb with node.js?

By : Travis

I'm using the current application stack:

node.js, mongodb, express (for node.js), and mongoose (for node.js ... gives me orm capabilities)

I'm getting used to everything and have the regular CRUD stuff working. However, I can't figure out how to store binary/gridfs/BSON stuff in mongo and retrieve it.

Can someone give me an example using node.js/mongo/mongoose or know of a good one or know if its possible?

By : Travis


According to Guillermo Rauch from the mongoose project, adding support to GridFS is not their priority right now (

Mentioned this here, so that somebody interested may pickup the task and hack GridFS support into mongoose.

By : shashi lists down how you can add BSON Binary type using the node-mongodb-native.

This video can help you solving your question :)
By: admin