A wrapper for node-mongodb-native as close as possible to the native javascript driver. Why learn two interfaces?
Yes, we know other people are doing the same thing. This one has been easier to use.
- Minimal interface closely matching the command-line driver: http://www.mongodb.org/display/DOCS/Manual
- Lazy open/close of connections
- Most features of node-mongodb-native
- Connection pooling. Each db will share a single connection.
npm install mongodb-wrapper
- You have to tell the db object which collections you're about to use (Harmony Proxies, I need you!)
- You have to provide callbacks on "actionable" calls (
toArray
,count
, but notfind
) - Otherwise, just like the native javascript driver
var mongo = require('mongodb-wrapper') var db = mongo.db('localhost', 27017, 'test') db.collection('posts') db.posts.save({title: "A new post", body: "Here is some text"}, function(err, post) { db.posts.findOne({_id: doc._id}, function(err, post) { db.posts.find().limit(1).toArray(function(err, posts) { // posts[0].title == "A new post" }) }) })
For more examples, please look at the test suite