Skip to content
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

support read preferences #165

Open
linearb opened this issue Apr 27, 2016 · 2 comments
Open

support read preferences #165

linearb opened this issue Apr 27, 2016 · 2 comments

Comments

@linearb
Copy link

linearb commented Apr 27, 2016

txmongo should, like pymongo, fully support read preferences, to permit, for example, failover
to primary, or nearest. Behavior, should be like pymongo 3.2.2 as described here:
https://api.mongodb.org/python/current/api/pymongo/read_preferences.html#module-pymongo.read_preferences.

PRIMARY: Read from the primary. This is the default read preference, and provides the strongest consistency. If no primary is available, raise AutoReconnect.
PRIMARY_PREFERRED: Read from the primary if available, otherwise read from a secondary.
SECONDARY: Read from a secondary. If no matching secondary is available, raise AutoReconnect.
SECONDARY_PREFERRED: Read from a secondary if available, otherwise from the primary.
NEAREST: Read from any available member.

(Note an edge case that should be handled correctly:
pymongo, when connected to a mongod that happens to be a member of a replica set,
using SECONDARY and the replicaSet option unset, does not failover to other replicaset members.
But the current txmongo code seems to append the members of the set to __allnodes whether or
not replicaSet is set. )

@E4gle
Copy link

E4gle commented Feb 5, 2018

Are there any updates regarding this request ?
It would be really useful if this was supported, without this feature using replicaSet is pointless since all connections are always directed to the primary.

@psi29a
Copy link
Contributor

psi29a commented Feb 5, 2018

If someone would like to get their hands dirty and contribute a PR, we'd be happy to review. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants