Closed edahlseng closed 4 years ago
It sounds like Mongoose should automatically reconnect to replica sets regardless of the reconnect settings, and so there might be a bug here. See #8325 for more details.
When connected to a replica set, mongoose will continue to try to reconnect indefinitely. That's why the reconnectTries
option does nothing for replica sets - there's no way to tell the mongodb driver to stop trying to reconnect to a replica set after a certain number of failures.
Do you want to request a feature or report a bug? Ask a question
What is the current ~behavior~ question? In the documentation for the
openUri
function, there is an option,reconnectTries
, that says (emphasis mine):Why does reconnection not work for replica set connections? Is there another way to achieve reconnection with replica sets? (Please forgive me if this has been answered somewhere else – I checked a number of closed issues, but they all seemed to refer to bugs related to reconnect events, and I still haven't found a good answer to this question 😕.)