Replace yourdbname
with your variable or just link of your mongodb
..
mongoose.connect(yourdbname, {useUnifiedTopology: true, useNewUrlParser: true, useCreateIndex: true })
.then(console.log("mongodb connected successfully...."))
.catch(err =>console.log(err));