ReplicaSetConnection('%s:27018,%s:27018,%s:27018' % ('ip0','ip2','ip1'), replicaSet = 'rs0', read_preference=0)['beehoo']
| NEAREST = 4
| PRIMARY = 0
| PRIMARY_PREFERRED = 1
| SECONDARY = 2
| SECONDARY_ONLY = 2
| SECONDARY_PREFERRED = 3
PRIMARY: Queries are sent to the primary of the replica set.
PRIMARY_PREFERRED: Queries are sent to the primary if available, otherwise a secondary.
SECONDARY: Queries are distributed among secondaries. An error is raised if no secondaries are available.
SECONDARY_PREFERRED: Queries are distributed among secondaries, or the primary if no secondary is available.
NEAREST: Queries are distributed among all members.
pymongo 副本及链接 说明