mongoose.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true });
mongoose.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true });
const mongoose = require('mongoose');
mongoose
.connect(connection_string, {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
})
.then((con) => {
console.log("connected to db");
});
MongoClient.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true })