@@ -144,6 +144,66 @@ Server Selection
144
144
| **MongoClient Example**: ``server_selector = your_function``
145
145
| **Connection URI Example**: N/A
146
146
147
+ Connection Pools
148
+ ~~~~~~~~~~~~~~~~
149
+
150
+ .. list-table::
151
+ :widths: 30 70
152
+ :header-rows: 1
153
+
154
+ * - Setting
155
+ - Description
156
+
157
+ * - ``connectTimeoutMS``
158
+ - | Sets the time that {+driver-short+} waits when connecting a new
159
+ socket before timing out.
160
+ | Defaults to ``20000``
161
+
162
+ * - ``maxConnecting``
163
+ - | Sets the maximum number of connections that each pool can establish concurrently.
164
+ If this limit is reached, further requests wait until a connection is established
165
+ or another in-use connection is checked back into the pool.
166
+ | Defaults to ``2``
167
+
168
+ * - ``maxIdleTimeMS``
169
+ - | Sets the maximum time that a connection can remain idle in the pool.
170
+ | Defaults to ``None`` (no limit)
171
+
172
+ * - ``maxPoolSize``
173
+ - | Sets the maximum number of concurrent connections that the pool maintains.
174
+ If the maximum pool size is reached, further requests wait until a connection
175
+ becomes available.
176
+ | Defaults to ``100``
177
+
178
+ * - ``minPoolSize``
179
+ - | Sets the minimum number of concurrent connections that the pool maintains. If
180
+ the number of open connections falls below this value due to network errors,
181
+ {+driver-short+} attempts to create new connections to maintain this minimum.
182
+ | Defaults to ``0``
183
+
184
+ * - ``socketTimeoutMS``
185
+ - | Sets the length of time that {+driver-short+} waits for a response from the server
186
+ before timing out.
187
+ | Defaults to ``None`` (no timeout)
188
+
189
+ * - ``waitQueueTimeoutMS``
190
+ - | Sets how long a thread waits for a connection to become available in the connection pool
191
+ before timing out.
192
+ | Defaults to ``None`` (no timeout)
193
+
194
+ The following code creates a client with a maximum connection pool size of ``50`` by using the
195
+ ``maxPoolSize`` parameter:
196
+
197
+ .. code-block:: python
198
+
199
+ client = MongoClient(host, port, maxPoolSize=50)
200
+
201
+ The following code creates a client with the same configuration as the preceding example,
202
+ but uses a connection URI:
203
+
204
+ .. code-block:: python
205
+
206
+ client = MongoClient("mongodb://<host>:<port>/?maxPoolSize=50")
147
207
Authentication
148
208
~~~~~~~~~~~~~~
149
209
0 commit comments