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?
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?
Share Improve this question asked Dec 22, 2010 at 19:38 TravisTravis 7,50712 gold badges45 silver badges52 bronze badges 3- 1 Looks like mongoose depends on node-mongodb-native which can store binary data files I guess according to its github: github./christkv/node-mongodb-native Seems like mongoose just needs some good wrapper functionality for files to access this? – Travis Commented Dec 22, 2010 at 20:14
- I think thats probably what I'll do since I'm using amazon ec2 ... ill probably just store them in s3 and store their locations in the database – Travis Commented Dec 22, 2010 at 21:49
- 1 I'm now significantly happier and using another one of TJ's libraries for node: github./LearnBoost/knox ... for storing them to s3 ... way better than putting them into mongo – Travis Commented Dec 22, 2010 at 22:30
2 Answers
Reset to default 2According to Guillermo Rauch from the mongoose project, adding support to GridFS is not their priority right now (http://groups.google./group/mongoose-orm/browse_thread/thread/1bce50d90680d502)
Mentioned this here, so that somebody interested may pickup the task and hack GridFS support into mongoose.
https://github./christkv/node-mongodb-native/blob/master/examples/types.js#L30 lists down how you can add BSON Binary type using the node-mongodb-native.