co-mongo icon indicating copy to clipboard operation
co-mongo copied to clipboard

Update node-mongodb-native to v2

Open yawnt opened this issue 9 years ago • 5 comments

mongodb dep should be bumped > 2.0 :)

yawnt avatar Apr 06 '15 16:04 yawnt

Please update deps version.

zhuqling avatar Apr 07 '15 21:04 zhuqling

bump

alleles avatar May 26 '15 21:05 alleles

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

thomseddon avatar May 27 '15 09:05 thomseddon

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?

yvele avatar Jun 08 '15 21:06 yvele

proposed #15

jbielick avatar Nov 29 '15 20:11 jbielick