mongoose.connect(process.env.DB, { useCreateIndex: true, useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: false code example

Example 1: DeprecationWarning: current Server Discovery and Monitoring engine is deprecated,

mongoose.connect("paste db link", {useUnifiedTopology: true, useNewUrlParser: true, useCreateIndex: true });

Example 2: DeprecationWarning: current Server Discovery and Monitoring engine is deprecated,

mongoose.connect(uri, { useNewUrlParser: true,useUnifiedTopology:true });
mongoose.createConnection(uri, { useNewUrlParser: true });

Tags:

Misc Example