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

By : Travis
Source: Stackoverflow.com
Question!

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


Answers

According to Guillermo Rauch from the mongoose project, adding support to GridFS is not their priority right now (http://groups.google.com/group/mongoose-orm/browse_thread/thread/1bce50d90680d502)

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

By : shashi


https://github.com/christkv/node-mongodb-native/blob/master/examples/types.js#L30 lists down how you can add BSON Binary type using the node-mongodb-native.



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