-
Type: Bug
-
Resolution: Done
-
Priority: Trivial - P5
-
Affects Version/s: 3.0, 3.0.1
-
Component/s: None
-
None
-
Environment:3.0.2-1-dce3f36
I'm passing around a MongoClient and sometimes need to know what I'm connected to (previously we used host, port).
It looks like client.nodes is empty for sometime after Client creation:
In [32]: for i in xrange(1000): c = pymongo.MongoClient('cn14-ib:27119') time.sleep(0.00001) assert c.nodes, i ....: --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-32-993619bacd76> in <module>() 2 c = pymongo.MongoClient('cn14-ib:27119') 3 time.sleep(0.00001) ----> 4 assert c.nodes, i 5 AssertionError: 12
nodes
List of all connected servers.
Nodes are either specified when this instance was created, or discovered through the replica set discovery mechanism.
In this case nodes is empty, so is neither what was passed into the MongoClient, nor discovered...
If you put a server_info() in there, then nodes is reliable. Is there a better way to get the original connection string?