The following is my code:
mongoose.connect(\'mongodb://localhost/mydatabase\'); var db = mongoose.connection; db.on(\'error\', console.error.bind(console, \'co
I faced similar issue.
I was calling process.exit(0) after queries, so the app exited before mongoose have a chance to run callback.
process.exit(0)
So i removed process.exit(0) and it worked!