DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option useNewUrlParser: true to MongoClient.connect.

136

DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. -

mongoose.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true });

{ useNewUrlParser: true } to MongoClient.connect. warnning -

mongoose.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true });

DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. -

const mongoose = require('mongoose');

mongoose
  .connect(connection_string, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useCreateIndex: true,
    useFindAndModify: false,
  })
  .then((con) => {
    console.log("connected to db");
  });

To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect -

MongoClient.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true })

Comments

Submit
0 Comments