Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html

操作数据库的时候,老是提示:Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html

增删改都没有问题,但是很影响排错。

解决办法:在连接数据库的时候,添加mongoose.Promise = global.Promise;

mongoose.connect(url, mongoOptions);
mongoose.Promise = global.Promise;
mongoose.connection.on('error', function (err) {
    console.log('Mongo Error:' + err);
}).on('open', function () {
    console.log('Connection opened');
});

 

posted @ 2017-03-09 16:32  liziyou  阅读(1077)  评论(0编辑  收藏  举报