// after you connect
// uri ( or connection string ) is defined somewhere
const mongoose = require("mongoose")
mongoose.connect(uri, {useNewUrlParser: true, useUnifiedTopology: true})
.then(console.log(`Data base connected ${mongoose.connection.readyState}`))
.catch(error => console.log(error))
// readyState gives you the state of the connection
// after you connect
// uri ( or connection string ) is defined somewhere
const mongoose = require("mongoose")
mongoose.connect(uri, {useNewUrlParser: true, useUnifiedTopology: true})
.then(console.log(`Data base connected ${mongoose.connection.readyState}`))
// readyState gives you the state of the connection