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 issueHi, 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:
- Created 4 years ago
- Reactions:10
- Comments:20 (1 by maintainers)
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}
); });It still error:
It output:
Anyone can help me? Thanks!