如何使用bluebird宣传MongoDB本机Javascript驱动程序? [英] How can I promisify the MongoDB native Javascript driver using bluebird?
本文介绍了如何使用bluebird宣传MongoDB本机Javascript驱动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 MongoDB原生JS驱动程序 https://github.com/petkaantonov/bluebird =noreferrer> bluebird承诺。我如何使用 承诺这个库上的.promisifyAll()
?
I'd like to use the MongoDB native JS driver with bluebird promises. How can I use Promise.promisifyAll()
on this library?
推荐答案
2.0分支文档包含一个更好的宣传指南 https://github.com/petkaantonov/bluebird/blob/master/API.md #promisification
The 2.0 branch documentation contains a better promisification guide https://github.com/petkaantonov/bluebird/blob/master/API.md#promisification
它实际上有mongodb示例,这更简单:
It actually has mongodb example which is much simpler:
var Promise = require("bluebird");
var MongoDB = require("mongodb");
Promise.promisifyAll(MongoDB);
这篇关于如何使用bluebird宣传MongoDB本机Javascript驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文