I am using monk on a code that looks like
var monk = require('monk')
var db = monk('localhost/mydb')
if(!db){
console.log('no connection')
}
when I run it, console logs 'no connection', but I would like to know why it is not connecting, (maybe see a stack trace' how do I do that?
Looks like this is known bug. https://github.com/Automattic/monk/issues/24
In your snippet, monk(url) returns db object whether connection or not.
This is db object on connection
This is db object when mongodb is not running
Maybe for now, you can use _native._state for checking connection.