Mongoose报错DeprecationWarning

DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

只需要在里面添加上useUnifiedTopology: true

module.exports = app => {
  const mongoose = require('mongoose')
  mongoose.connect('mongodb://127.0.0.1:。。。', {
    useNewUrlParser:true,
    //添加这一行即可
    useUnifiedTopology: true 
  })
}

总之就是报错是什么就添加什么

你可能感兴趣的:(前端)