Skip to content

Commit e56acba

Browse files
committed
PYTHON-1864 Update outdated comment in MongoClient._socket_from_server
1 parent 66e9993 commit e56acba

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pymongo/mongo_client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,12 +1144,11 @@ def _socket_for_writes(self, session):
11441144
@contextlib.contextmanager
11451145
def _socket_from_server(self, read_preference, server, session):
11461146
assert read_preference is not None, "read_preference must not be None"
1147-
# TODO: update this comment.
11481147
# Get a socket for a server matching the read preference, and yield
1149-
# sock_info, read_preference. Server Selection Spec: "SecondaryOK must
1150-
# be sent to mongods with topology type Single. If the server type is
1151-
# Mongos, follow the rules for passing read preference to mongos, even
1152-
# for topology type Single."
1148+
# sock_info with the effective read preference. The Server Selection
1149+
# Spec says not to send any $readPreference to standalones and to
1150+
# always send primaryPreferred when directly connected to a repl set
1151+
# member.
11531152
# Thread safe: if the type is single it cannot change.
11541153
topology = self._get_topology()
11551154
single = topology.description.topology_type == TOPOLOGY_TYPE.Single

0 commit comments

Comments
 (0)