mongodb wrapper to use with co and koa.

npm install co-mongodb
15 downloads in the last week
40 downloads in the last month


Build Status

Manipulation library to use the mongodb native driver with generator based flow control libraries such as co.


$ npm install co-mongodb


var comongo = require('co-mongodb');

co(function *() {
  // db is just a regular Db instance from the native driver.
  db = yield comongo.client.connect('mongodb://localhost:27017/test');

  // The same goes for collection.
  var collection = yield comongo.db.collection(db, 'testCollection');

  var result = yield comongo.db.addUser(db, 'user', 'pass');
  var user = result[0];
  yield comongo.db.removeUser(db, 'user');

  yield comongo.db.close(db);

Supported functions

More to come soon...

npm loves you