Skip to content

Commit d9d8b12

Browse files
committed
PYTHON-2726 Document read preference quirks
(cherry picked from commit a94504b)
1 parent 866ed88 commit d9d8b12

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

doc/mongo_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def process_mongodoc_nodes(app, doctree, fromdocname):
7575
anchor = name["ids"][0]
7676
break
7777
for para in node.traverse(nodes.paragraph):
78-
tag = str(para.traverse()[1])
78+
tag = str(list(para.traverse())[1])
7979
link = mongoref("", "")
8080
link["refuri"] = "http://dochub.mongodb.org/core/%s" % tag
8181
link["name"] = anchor

pymongo/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class NotMasterError(AutoReconnect):
116116
Use :exc:`~pymongo.errors.NotPrimaryError` instead.
117117
118118
.. versionchanged:: 3.12
119-
Deprecated. Use :exc:`~pymongo.errors.NotPrimaryError` instead.
119+
Deprecated. Use :exc:`~pymongo.errors.NotPrimaryError` instead.
120120
"""
121121
def __init__(self, message='', errors=None):
122122
super(NotMasterError, self).__init__(

pymongo/read_preferences.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ class PrimaryPreferred(_ServerMode):
268268
* When connected to a replica set queries are sent to the primary if
269269
available, otherwise a secondary.
270270
271+
.. note:: When a :class:`~pymongo.mongo_client.MongoClient` is first
272+
created reads will be routed to an available secondary until the
273+
primary of the replica set is discovered.
274+
271275
:Parameters:
272276
- `tag_sets`: The :attr:`~tag_sets` to use if the primary is not
273277
available.
@@ -346,6 +350,10 @@ class SecondaryPreferred(_ServerMode):
346350
* When connected to a replica set queries are distributed among
347351
secondaries, or the primary if no secondary is available.
348352
353+
.. note:: When a :class:`~pymongo.mongo_client.MongoClient` is first
354+
created reads will be routed to the primary of the replica set until
355+
an available secondary is discovered.
356+
349357
:Parameters:
350358
- `tag_sets`: The :attr:`~tag_sets` for this read preference.
351359
- `max_staleness`: (integer, in seconds) The maximum estimated

0 commit comments

Comments
 (0)