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. code example

Example 1: { useNewUrlParser: true } to MongoClient.connect. warnning

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

Example 2: 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 });

Example 3: 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(DB, {
    useNewUrlParser: true,
    useCreateIndex: true,
    useUnifiedTopology: true,
    useFindAndModify: false,
  })

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

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