1
votes

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

1

1 Answers

1
votes

With connect function:

mongoose.connect('mongodb://localhost:27017/DATABASE', { useUnifiedTopology: true }});

With MongoClient:

var mongoclient = new MongoClient(new Server("localhost", 27017), { useUnifiedTopology: true });

Simply send options object to second parameter.