Travis
Travis

Reputation: 7507

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

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?

Upvotes: 4

Views: 8480

Answers (2)

Samyak Bhuta
Samyak Bhuta

Reputation: 1254

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.

Upvotes: 2

shashi
shashi

Reputation: 21

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.

Upvotes: 2

Related Questions