1.0.3 • Published 8 years ago

mongomery v1.0.3

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

Mongomery

Generator based flow-control driver for MongoDB.

Mongomery has API like mongodb-native has, but based on es6 generators.

Install

npm i mongomery --save

How come?

With help of ES6 generators flow-control of interaction with MongoDB could be much simpler. Mongomery will save your code from callback hell.

Hot to use?

var mongomery = require('mongomery');

mongomery(function*(mongo) {
    var url         = 'mongodb://localhost:27017/myproject',
        db          = yield mongo.connect(url),
        collection  = db.collection('mongolog'),
        docs        = yield collection.find({}).toArray();
        
    docs.forEach(function(item) {
        console.log(item);
    });
    
    db.close();
}).on('error', function(error) {
    console.log(error.message);
});

License

MIT