-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
useUnifiedTopology=true fails when replica node unvailable #8209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is the correct behaviour - the client shouldn't connect if it is unable to perform all of its actions. In particular, transactions can't work unless the replica set is healthy. |
It's different from what mongo shell does, and it's different from the old mongoose behavior too. What's the point in having a replica set if all nodes have to be healthy all the time? Supposedly HA replica set is unavailable when it could provide availability. Providing a specifically requested level of write concern is another matter. |
I see what you're saying. Interestingly, there is the option of There also seems to be some options available specifically related to high availability: My understanding of a highly available replica set is that unless it is actually highly available, it's not healthy and therefore shouldn't be connected to, at least in production environments. Alternatively, if you know the specific node you want to connect to, you can just specify that single node in the connection string. |
Yeah it seemed strange to me there is Update ha=false, haInterval, minSize=1, don't fix issue. |
I opened up an issue with the mongodb driver: https://jira.mongodb.org/browse/NODE-2231 . In the meantime, if this is blocking you, please turn |
Thanks @vkarpov15 |
It looks like mongodb driver version 3.3.3 was released and a fix for NODE-2231 landed. Will mongoose be releasing 5.7.6 soon? |
@esetnik we shipped v5.7.6 2 days ago 👍 |
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
If I try and connect with this MongoDB connection URL and useUnifiedTopology=true:
Mongoose fails with:
mongo0
is PRIMARY and is up. mongo1 and mongo2 are down. The mongo db shell successfully connects with this string. So this isn't BWC behavior?? Tried a few different options to do with read write concern (ex.readConcern=local&w=0&readPrefernce=primary
) but still same error.If I set useUnifiedTopology=false I get an ugly deprecation warning.
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
Connect same way mongo shell does. Don't deny availability to my HA replica set when the primary is available.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Mongoose: 5.7.1
MongoDB: 4.2.0
Node: v10.16.3
The text was updated successfully, but these errors were encountered: