Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get mongoose connection status

// 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
 
PREVIOUS NEXT
Tagged: #mongoose #connection #status
ADD COMMENT
Topic
Name
4+1 =