使用mongoose进行数据库操作时,总是提示:
(node:5684) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
解决方法:
在var db = mongoose.connect("mongodb://127.0.0.1:27017/mongooseTest"); 之前加一句:
mongoose.Promise = global.Promise;
最后:
- mongoose.Promise = global.Promise;
- var db = mongoose.connect("mongodb://127.0.0.1:27017/mongooseTest");
这样就好了。
参考资料: