Skip to content

Commit e1b75fa

Browse files
committed
wip
1 parent 10e63b7 commit e1b75fa

File tree

2 files changed

+71
-10
lines changed

2 files changed

+71
-10
lines changed

source/connect/connection-options.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,66 @@ Server Selection
144144
| **MongoClient Example**: ``server_selector = your_function``
145145
| **Connection URI Example**: N/A
146146

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")
147207
Authentication
148208
~~~~~~~~~~~~~~
149209

source/index.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,31 @@ MongoDB {+driver-short+} Documentation
1212

1313
.. toctree::
1414

15-
Get Started </get-started>
15+
Getting Started </get-started>
1616
Connect </connect>
17+
CRUD Operations
18+
Data Formats </data-formats>
19+
Indexes </indexes>
20+
Run a Database Command </run-command>
21+
Logging </logging> Monitoring </monitoring>
22+
Security </security>
23+
Versioning
24+
API Documentation <{+api-root+}>
25+
Issues & Help </issues-and-help>
26+
1727
Databases & Collections </databases-collections>
1828
Write Data </write-operations>
1929
Read Data </read>
20-
Run a Database Command </run-command>
21-
Indexes </indexes>
2230
Aggregation </aggregation>
23-
Security </security>
24-
Data Formats </data-formats>
25-
Logging </logging>
26-
Monitoring </monitoring>
2731
Serialization </serialization>
2832
Third-Party Tools </tools>
29-
FAQ </faq>
3033
Troubleshooting </troubleshooting>
3134
What's New </whats-new>
3235
Upgrade </upgrade>
3336
Migrate from Motor </motor-async-migration>
3437
Switch to PyMongo Async </pymongo-to-async-guide>
3538
Previous Versions </previous-versions>
36-
Issues & Help </issues-and-help>
3739
Compatibility </compatibility>
38-
API Documentation <{+api-root+}>
3940

4041
Overview
4142
--------

0 commit comments

Comments
 (0)