Are the answers in this question relevant: How can I roll over my own Javascript MongoDB driver using bluebird?
I donβt know since it was updated, but the 2.0 JS driver for MongoDB has a property in the options promiseLibrary object: http://mongodb.imtqy.com/node-mongodb-native/2.0/api/MongoClient.html
And most methods / functions return a promise, for example, Cursor.toArray() .
However, I cannot find an example using this new option, but isnβt it easier to use:
MongoClient.connect('mongodb://URL', { promiseLibrary: require('bluebird') });
Or is this definition incorrect? - In which case, how should it be correctly defined?
Update:
The code runs on io.js, so I donβt even need to specify promiseLibrary , since the driver will use ES6 promises? - However, presumably, bluebird promises is slower:
Why is the native ES6 promises slower and more memory intensive than bluebird?
Update2: I added the bluebird tag - maybe the guys working on bluebird can provide more details if the promise is really better than using MongoDB's own implementation?
source share