Archive for:

Mongoose connection events and reconnecting to MongoDB

I’ve seen many methods to have mongoose reconnect to mongo after an error. This is a huge problem, especially if the network drops for even a second. In our app, mongoose didn’t even know the connection had dropped, and our application would not be able to reach the database. To fix this, we had to force mongoose to reconnect on it’s own.