Skip to content

Commit 3d65bab

Browse files
committed
PYTHON-927 - Document the non-static nature of MongoClient.nodes
1 parent 4cb6815 commit 3d65bab

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pymongo/mongo_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,14 @@ def max_pool_size(self):
555555

556556
@property
557557
def nodes(self):
558-
"""List of all connected servers.
559-
560-
Nodes are either specified when this instance was created,
561-
or discovered through the replica set discovery mechanism.
558+
"""Set of all currently connected servers.
559+
560+
.. warning:: When connected to a replica set the value of :attr:`nodes`
561+
can change over time as :class:`MongoClient`'s view of the replica
562+
set changes. :attr:`nodes` can also be an empty set when
563+
:class:`MongoClient` is first instantiated and hasn't yet connected
564+
to any servers, or a network partition causes it to lose connection
565+
to all servers.
562566
"""
563567
description = self._topology.description
564568
return frozenset(s.address for s in description.known_servers)

0 commit comments

Comments
 (0)