Skip to content

Commit cbadc00

Browse files
committed
Change
1 parent 17f7471 commit cbadc00

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

source/connect/connection-targets.txt

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,33 +68,21 @@ deployment:
6868
uri = "mongodb://localhost:27017/"
6969
client = MongoClient(uri)
7070

71-
Multiple Deployments
72-
--------------------
71+
Replica Sets
72+
------------
7373

74-
You can connect to multiple MongoDB deployments by specifying a list of deployments
75-
in your connection string.
74+
To connect to a replica set, specify the hostnames (or IP addresses) and
75+
port numbers of the replica-set members in your connection string.
7676

77-
The following code shows how to use {+driver-short+} to connect to three deployments:
77+
The following code shows how to use {+driver-short+} to connect to a replica set
78+
that contains three hosts:
7879

7980
.. code-block:: python
8081

8182
from pymongo import MongoClient
8283

8384
client = MongoClient("mongodb://host1:27017,host2:27017,host3:27017")
8485

85-
{+driver-short+} evenly load balances operations across the specified deployments
86-
within the specified ``localThresholdMS`` of the lowest-latency deployment. The
87-
``localThresholdMS`` option defaults to ``15``.
88-
89-
To learn more about how {+driver-short+} load balances operations across multiple
90-
MongoDB deployments, see the :ref:`pymongo-server-selection` guide.
91-
92-
Replica Sets
93-
------------
94-
95-
To connect to a replica set, specify the hostnames (or IP addresses) and
96-
port numbers of the replica-set members in your connection string.
97-
9886
If you aren't able to provide a full list of hosts in the replica set, you can
9987
specify one or more of the hosts in the replica set and instruct {+driver-short+} to
10088
perform automatic discovery to find the others. To instruct the driver to perform
@@ -115,6 +103,13 @@ hosts, including ``host1``:
115103
uri = "mongodb://host1:27017/?replicaSet=sampleRS"
116104
client = MongoClient(uri)
117105

106+
{+driver-short+} evenly load balances operations across the specified deployments
107+
within the specified ``localThresholdMS`` of the lowest-latency deployment. The
108+
``localThresholdMS`` option defaults to ``15``.
109+
110+
To learn more about how {+driver-short+} load balances operations across multiple
111+
MongoDB deployments, see the :ref:`pymongo-server-selection` guide.
112+
118113
.. note::
119114

120115
The ``MongoClient`` constructor is *non-blocking*.

0 commit comments

Comments
 (0)