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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.5
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.5
    1
  • 0.0.4
    1
  • 0.0.3
    1
  • 0.0.2
    1
  • 0.0.1
    1

Package Sidebar

Install

npm i comongo

Weekly Downloads

4

Version

0.0.5

License

MIT

Last publish

Collaborators

  • yorkie