In a hosted MEAN stack application the following happened with the MongoDB replica set as reported by the hosting company's tech support:
There was a three minute window where a new primary was briefly elected. It looks like some network issues caused the primary to lose connection to the secondaries. The window was only 3 minutes and the primary was then re-elected normally.
Once everything was back to normal my Node.js application, which uses the Mongoose framework, did not re-establish its connection to the primary causing a "Cannot write to a secondary" error to be logged.
Question: What setting(s) when using Mongoose and/or the MongoDB Driver that it uses could prevent the automatic reconnect after the primary switched back? (i.e. how do I prevent this from happening again?)
Using Mongoose v3.8.26