Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise libr

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

增删改都没有问题,可是很影响排错。数据库

解决办法:在链接数据库的时候,添加mongoose.Promise = global.Promise;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');
});
相关文章
相关标签/搜索