简体   繁体   中英

DeprecationWarning: current Server Discovery and Monitoring engine is deprecated

I know, I know the problem has been has been solved except, it hasn't.

I'm running:

mongoose 5.8.4 and nodemon 2.0.2 in case it's relevant.

const mongoose = require('mongoose');
const config = require('config');
const db = config.get('mongoURI');

const connectDB = () => {
  mongoose
    .connect(db, {
      useNewUrlParser: true,
      useCreateIndex: true,
      useFindAndModify: false
      // useUnifiedTopology: true
    })
    .then(() => console.log('MongoDB connected!'))
    .catch(err => {
      console.error(err.msg);
      process.exit(1);
    });
};

module.exports = connectDB;

When I run the server with useUnifiedTopology: true after 30 or so seconds a msg shows up saying:

[nodemon] app crashed - waiting for file changes before starting...

Any ideas on how to fix this bug?

Created a new cluster on Atlas and everything works fine. Thanks anyways, guys.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM