How can I promisify the MongoDB native Javascript driver using bluebird?

前端 未结 5 588
情书的邮戳
情书的邮戳 2020-11-27 17:41

I\'d like to use the MongoDB native JS driver with bluebird promises. How can I use Promise.promisifyAll() on this library?

5条回答
  •  醉酒成梦
    2020-11-27 18:10

    Version 1.4.9 of mongodb should now be easily promisifiable as such:

    Promise.promisifyAll(mongo.Cursor.prototype);
    

    See https://github.com/mongodb/node-mongodb-native/pull/1201 for more details.

提交回复
热议问题