egg项目报错:Current Server Discovery and Monitoring engine is deprecated, and will be removed in a futu

[MONGODB DRIVER] Warning: 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.
(Use node --trace-warnings ... to show where the warning was created

当前的服务器发现和监视引擎已弃用,并将在将来的版本中删除。要使用新的服务器发现和监控引擎,请将选项{useUnifiedTopology:true}传递给MongoClient构造函数。

(使用“node–trace warnings…”显示创建警告的位置
修改前

    mongoose: {
    
    
      client: {
    
    
        // 链接到本地的MongoDB,note是我本地数据库的名字
        url: 'mongodb://127.0.0.1:27017/note',
        options: {
    
    
          // dbName: 'note',
          useNewUrlParser: true,
        },
      },
    },

修改后

    mongoose: {
    
    
      client: {
    
    
        // 链接到本地的MongoDB,note是我本地数据库的名字
        url: 'mongodb://127.0.0.1:27017/note',
        options: {
    
    
          // dbName: 'note',
          // useNewUrlParser: true,
          useUnifiedTopology: true,
        },
      },
    },

猜你喜欢

转载自blog.csdn.net/weixin_40119412/article/details/130393843