useUnifiedTopology option causes HA to fail to reconnect #8224
Labels
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
Milestone
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using a mongodb URL that uses a replica set in combination with the
useUnifiedTopology
flag the replica set connection will fail to reestablish if one of the members in the collection goes offline. This is a regression from previous behavior where the following was noticed:If the current behavior is a bug, please provide the steps to reproduce.
Setup a 3 instance mongod cluster with replication. I do this using docker with a small script I wrote. If you would like to use it I would be happy to attach it: just ask. Anyways I made the following script with hooks to demonstrate:
I invoke the script with the URL and disable or enable the
useUnifiedTopology
flag (either via the URL or via my options within the script) and then I proceed to shutdown one of the replicas unexpectedly. Below is the output:With
useUnifiedTopology
enabled (does not matter if primary or secondary)Mongoose sits in the disconnected state and never recovers automatically.
With
useUnifiedTopology
disabled (knocked out secondary)With
useUnifiedTopology
disabled (knocked out primary)What is the expected behavior?
HA topology handles failure gracefully and reconnects at an absolute minimum.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
The text was updated successfully, but these errors were encountered: