question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

See original GitHub issue

Hi, I just downloaded latest version of mongoose from npm and tried to run it but it gave me this warning: 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.

i added this option to my configuration but it still gives me this warning. here is my configuration

mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useFindAndModify: false, useCreateIndex: true, useUnifiedTopology: true }).then(()=>{ console.log(connection to database established) }).catch(err=>{ console.log(db error ${err.message}); process.exit(-1) })

any clue?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:20 (1 by maintainers)

github_iconTop GitHub Comments

26reactions
TREaganscommented, Sep 18, 2019

This works fine for me, and no more errors.

mongoose .connect(process.env.MONGO_URI, { useUnifiedTopology: true, useNewUrlParser: true, }) .then(() => console.log(‘DB Connected!’)) .catch(err => { console.log(DB Connection Error: ${err.message}); });

6reactions
kimproshcommented, Sep 25, 2019

It still error:

const options = {
    keepAlive: 1,
    useUnifiedTopology: true,
    useNewUrlParser: true,
  };
  mongoose.connect(dbUrl, options).then(() => console.log('DB connected'));

It output:

(node:14923) 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.

Anyone can help me? Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server Discovery And Monitoring engine is deprecated
DeprecationWarning : current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server...
Read more >
DeprecationWarning being triggered even with ... - MongoDB
DeprecationWarning : current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new ......
Read more >
[NODE-2138] "Server Discovery and Monitoring engine ...
DeprecationWarning : current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new ......
Read more >
DeprecationWarning: current Server Discovery and Monitoring ...
DeprecationWarning : current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server...
Read more >
Mongo db deprecated - General - Node-RED Forum
To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor. What is meant by ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found