Reputation: 7534
When starting up my application, I get the following warning:
(node:11800) 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.
Yet we are specifying this value:
connection = await mongoose.connect(dbUrl, {
keepAlive: true,
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true
});
The value for dbUrl
is: mongodb://localhost:27017/test-app
Environment:
mongo v4.0.13 on macOS
nodejs v10.15.3
package [email protected]
package [email protected]
Any ideas on how to deal with the warning?
Upvotes: 0
Views: 2898
Reputation: 50
This happens due to change in public ip address The only way that worked for me is by changing my public ip address inside mongodb atlas Go to cluster>network access>click on edit then change the ip address with your current public ip address
for checking you ip address type what is my public ip address on google and follow the first link
Upvotes: 1
Reputation: 11
This works fine for me, and no more errors.
try this,
mongoose
.connect(db,{
useUnifiedTopology: true,
useNewUrlParser: true,
})
.then(() => console.log('MongoDB Connected...'))
.catch(err => console.log(err));
Upvotes: 0