1.0.5 • Published 8 years ago

comongodb v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

co-mongodb

co version node-mongodb-native.

why we need this:

mongodb version is too old in cofy-mongodb

fix mongodb version problem of cofy-mongodb

##Installation

$ npm install comongodb --save

Old methods not change.New methods invoke convention: yield obj.$asyncMethod

Oo, I need star: here.

Example:

var mongodb = require('comongodb');
var MongoClient = mongodb.MongoClient;
var co = require('co');

co(function*(){
  var db = yield MongoClient.$connect('mongodb://localhost:27017/test');
  var collection = db.collection('test_users');
  var tom = {name:"tom",age:10};
  var tom1 = yield collection.$insert(tom);
  var tom2 = yield collection.find({name:"tom"}).sort('name').limit(1).$toArray();
  console.log(tom , tom1, tom2);
  yield collection.$remove({name:"tom"});
  db.close();
  tom1[0]._id.should.be.ok;
  tom2[0]._id.should.be.ok;
  tom2[0].should.eql(tom);
});
1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago