I'm working on a node app where we create all of our db connections upon startup. In the case of MongoDB, this allows us to use connection pooling.
Let's say hypothetically that MongoDB goes down sometime after the initial connection pool had been established.
Assuming I already have a method which handles retrying init'ing the connection at n*2 retry intervals, how would I detect a connection error during the app's life cycle so that I can go ahead and start with retrying to establish connection?
Is there an error event that is emitted when there is a connection error? Do I even need to worry about reestablishing the connection pool when a connection error occurs or will the connection pool automatically come back to life when MongoDB does?