Mongoose autoReconnect option
I had the same question as you, and robertklep’s solution didn’t work for me either. I found when MongoDB service is stopped, an error event is triggered, but the connection.readyState is still 1 (connected). That may be why it didn’t auto reconnect. This is what I have now: var db = mongoose.connection; db.on(‘connecting’, function() { … Read more