0.0.5 • Published 11 years ago

comongo v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
11 years ago

co-mongo

mongo coroutine library based on co and node-mongodb-native

Installation

$ npm install comongo

Usage

var mongo = require('comongo');
var db = yield mongo.connect('localhost/test');
var coll = db.collection('your coll name');

// insert
var ret = yield coll.insert({ hello: 'world' });

// cursor and query
var cur = coll.find({ hello: 'world' }).skip(0);

// toArray and foreach
(yield cur.toArray()).forEach(function(item) {
  // sync foreach, don't need care about async call
});

// Error handler
try {
  // your co-mongo codes
} catch (err) {
  // handles error from err
}

License

MIT

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago