I am a new in nodeJS and mongodb. I can not connect my code with mongodb. here is my code. when I run this code it gives me this,
(node:9160) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option
{ useNewUrlParser: true }toMongoClient.connect.
How can I fix it?
var express = require("express"); var mongoose = require("mongoose"); var passport = require("passport"); var bodyParser = require("body-parser"); var LocalStrategy = require("passport-local"); var passportLocalMongoose = require("passport-local-mongoose"); mongoose.connect("mongodb://localhost/mydb"); // mongoose.connect("mongodb://localhost:27017/mydb_login", { useNewUrlParser: true }) var app = express(); app.set("view engine", "ejs"); 