Como obter status de conexão de Mongoose
// 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
Code Sir