co-mongo
co-mongo copied to clipboard
Update node-mongodb-native to v2
mongodb dep should be bumped > 2.0 :)
Please update deps version.
bump
The whole API changed in 2 with different function signatures, depreciated methods, new methods etc. so this requires quite a bit of work!
Would be happy to look at a PR for this
Hi, I first wanted to fork + PR, but I made a brand new package: thunkify-mongodb which can be used in co-mongo (as a dependency).. But it can also be used directly:
var MongoClient = require('thunkify-mongodb').MongoClient;
var mongodb = require('mongodb');
function* insertSomething(url) {
var mongoClient = new MongoClient(new mongodb.MongoClient());
var db = yield mongoClient.connect(url);
var collection = yield db.collection('Documents');
yield collection.insertOne({ some: 'thing' });
yield db.close();
}
thunkify-mongodb use dependency injection, you can give him any 2.X.X MongoDB Native Driver version.
You can use it in co-mongo and provide extra congo sugar, etc... I think there is room for both packages: thunkify-mongodb provides the thunk wrapper and co-mongo adds sugar (congo, a predefined mongodb dependency, etc.).
What do you think?
proposed #15