It was a confusing API choice, which we regret in PyMongo 2.x. We will combine all client classes in MongoClient in PyMongo 3, in April 2015:
http://emptysqua.re/blog/good-idea-at-the-time-pymongo-mongoreplicasetclient/
Topics:
- Use MongoReplicaSetClient when you plan to connect to the entire replica set. MongoClient connects to only one .
- For performing primary or secondary readings, one MongoReplicaSetClient can be used, as well as more complex decision making with reading preferences, see my related blog post . MongoClient will connect to one member of the replica set (primary) and always read from it, unless you make a direct connection to the secondary using MongoClient, in which case it will always read from this secondary.
- MongoReplicaSetClient monitors the specified health with a background thread that periodically checks all members. The client keeps track of whether members are present, tracks their ping time and notices when a member is added. This will reduce the number of exceptions that you see on the elephant network or when the replica set configuration changes, and this allows the client to correctly implement the read settings.
- MongoReplicaSetClient really connects to all members, while MongoClient only connects to one . MongoReplicaSetClient tries to connect to each member specified in the connection string; as soon as he connects to one, he asks the member for a list of all the other members. From now on, it ignores your connection string and uses the list that it received from the member to which it connected.
source share