comongo

0.0.5 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i comongo

      Weekly Downloads

      5

      Version

      0.0.5

      License

      MIT

      Last publish

      Collaborators

      • yorkie