Skip to content

Commit 4c4e235

Browse files
committed
MW + MK PR fixes
1 parent 50af85d commit 4c4e235

File tree

6 files changed

+59
-49
lines changed

6 files changed

+59
-49
lines changed

source/connection/specify-connection-options.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Specify Connection Options
2222
.. toctree::
2323

2424
Stable API </connection/specify-connection-options/stable-api>
25-
Single Timeout Setting </connection/specify-connection-options/csot>
25+
Limit Execution Time </connection/specify-connection-options/csot>
2626
Connection Pools </connection/specify-connection-options/connection-pools>
2727
Cluster Settings </connection/specify-connection-options/cluster-settings>
2828
Server Settings </connection/specify-connection-options/server-settings>

source/connection/specify-connection-options/connection-pools.txt

+12-6
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,12 @@ see the corresponding syntax:
8787

8888
* - ``maxPoolSize``
8989

90-
- Maximum number of connections opened in the pool. When the
91-
connection pool reaches the maximum number of connections, new
92-
connections wait for up to the amount of time set by ``timeoutMS``.
90+
- Maximum number of connections opened in the pool. If an
91+
operation needs a new connection while the connection pool has
92+
``maxPoolSize`` connections open, the new
93+
operation waits for a new connection to open. To limit this
94+
waiting time, use the single timeout setting. To learn more,
95+
see the :ref:`java-csot` guide.
9396

9497
*Default:* ``100``
9598

@@ -103,10 +106,13 @@ see the corresponding syntax:
103106

104107
* - ``waitQueueTimeoutMS`` *(deprecated)*
105108

106-
- Maximum wait time in milliseconds that an operation can wait for
109+
- This option is deprecated. You can configure this timeout by
110+
setting the the :ref:`client-level timeout <java-csot>`
111+
instead.
112+
113+
Maximum wait time in milliseconds that an operation can wait for
107114
a connection to become available. A value of ``0`` means there
108-
is no limit. Set the :ref:`client-level timeout <java-csot>` to
109-
replace the functionality of this deprecated option.
115+
is no limit.
110116

111117
*Default*: ``120000`` (120 seconds)
112118

source/connection/specify-connection-options/csot.txt

+40-36
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ To specify a timeout when connecting to a MongoDB deployment, set the
3939
``timeoutMS`` connection option to the timeout length in milliseconds. You can
4040
set the ``timeoutMS`` option in the following ways:
4141

42-
- Using the ``timeout()`` method from the
42+
- Calling the ``timeout()`` method from the
4343
``MongoClientSettings.Builder`` class
4444
- Setting the ``timeoutMS`` parameter in your connection string
4545

46-
Select from the following :guilabel:`MongoClientSettings` and
47-
:guilabel:`Connection String` tabs to view how to set a client-level
48-
timeout of 5 seconds by using each method:
46+
The following code examples set a client-level timeout of ``5`` seconds.
47+
Select the :guilabel:`MongoClientSettings` or :guilabel:`Connection
48+
String` tab to see the corresponding code.
4949

5050
.. tabs::
5151

5252
.. tab:: MongoClientSettings
5353
:tabid: mongoclientsettings
5454

55-
.. literalinclude:: /includes/connect/CSOT.java
55+
.. literalinclude:: /includes/connect/CsotExample.java
5656
:language: java
5757
:start-after: start-mongoclientsettings
5858
:end-before: end-mongoclientsettings
@@ -62,14 +62,14 @@ timeout of 5 seconds by using each method:
6262
.. tab:: Connection String
6363
:tabid: connection-string
6464

65-
.. literalinclude:: /includes/connect/CSOT.java
65+
.. literalinclude:: /includes/connect/CsotExample.java
6666
:language: java
6767
:start-after: start-string
6868
:end-before: end-string
6969
:dedent:
7070

71-
Behavior
72-
~~~~~~~~
71+
Accepted Timeout Values
72+
~~~~~~~~~~~~~~~~~~~~~~~
7373

7474
The following table describes the timeout behavior corresponding to the
7575
accepted values for ``timeoutMS``:
@@ -81,11 +81,11 @@ accepted values for ``timeoutMS``:
8181
* - Value
8282
- Behavior
8383

84-
* - Positive value
84+
* - Positive integer
8585
- Sets the timeout to use for operation completion.
8686

8787
* - ``0``
88-
- Sets an infinite timeout.
88+
- Specifies that operations never time out.
8989

9090
* - ``null`` or unset
9191
- | Defers the timeout behavior to the following settings:
@@ -99,11 +99,11 @@ accepted values for ``timeoutMS``:
9999
| These settings are deprecated and are ignored if you set ``timeoutMS``.
100100

101101
If you specify the ``timeoutMS`` option, the driver automatically applies the
102-
specified timeout for each server operation. The following code example specifies
103-
a timeout of 5 seconds at the client level, and then calls the
102+
specified timeout to each server operation. The following code example specifies
103+
a timeout of ``5`` seconds at the client level, and then calls the
104104
``MongoCollection.insertOne()`` method:
105105

106-
.. literalinclude:: /includes/connect/CSOT.java
106+
.. literalinclude:: /includes/connect/CsotExample.java
107107
:language: java
108108
:start-after: start-operation-timeout
109109
:end-before: end-operation-timeout
@@ -124,24 +124,27 @@ The following table describes how the timeout value is inherited at each level:
124124
- Inheritance Description
125125

126126
* - Operation
127-
- Takes the highest precedence and will override ``timeoutMS``
128-
options set at any other level.
127+
- Takes the highest precedence and overrides the timeout
128+
options that you set at any other level.
129129

130130
* - Transaction
131-
- Takes precedence over ``timeoutMS`` set at the session,
131+
- Takes precedence over the timeout value that you set at the session,
132132
collection, database, or client level.
133133

134134
* - Session
135135
- Applies to all transactions and operations within
136-
that session, unless the option is overridden by options set at those levels.
136+
that session, unless you set a different timeout value at those
137+
levels.
137138

138139
* - Database
139140
- Applies to all sessions and operations within that
140-
database, unless the option is overridden by options set at those levels.
141+
database, unless you set a different timeout value at those
142+
levels.
141143

142144
* - Collection
143145
- Applies to all sessions and operations on that
144-
collection, unless the option is overridden by options set at those levels.
146+
collection, unless you set a different timeout value at those
147+
levels.
145148

146149
* - Client
147150
- Applies to all databases, collections, sessions, transactions, and
@@ -159,14 +162,15 @@ Overrides
159162
The {+driver-short+} supports various levels of configuration to control the
160163
behavior and performance of database operations.
161164

162-
You can specify a ``timeoutMS`` option at a lower level to override the
163-
client-level configuration. This allows you to customize timeouts based
164-
on the needs of individual operations.
165+
You can specify a ``timeoutMS`` option at a more specific level to override the
166+
client-level configuration. The table in the preceding section describes
167+
the levels at which you can specify a timeout setting. This allows you
168+
to customize timeouts based on the needs of individual operations.
165169

166170
The following example demonstrates how a collection-level timeout
167171
configuration can override a client-level timeout configuration:
168172

169-
.. literalinclude:: /includes/connect/CSOT.java
173+
.. literalinclude:: /includes/connect/CsotExample.java
170174
:language: java
171175
:start-after: start-override
172176
:end-before: end-override
@@ -182,7 +186,7 @@ When you create a new `ClientSession
182186
<{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/ClientSession.html>`__
183187
instance to implement a transaction, use
184188
the ``defaultTimeout()`` method when building a ``ClientSessionOptions``
185-
instance. You can use this option to specify the timeout to apply for
189+
instance. You can use this option to specify the timeout for
186190
the following methods:
187191

188192
- `commitTransaction() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/ClientSession.html#commitTransaction()>`__
@@ -193,7 +197,7 @@ the following methods:
193197
The following code demonstrates how to set the ``defaultTimeout`` when
194198
instantiating a ``ClientSession``:
195199

196-
.. literalinclude:: /includes/connect/CSOT.java
200+
.. literalinclude:: /includes/connect/CsotExample.java
197201
:language: java
198202
:start-after: start-session-timeout
199203
:end-before: end-session-timeout
@@ -202,12 +206,12 @@ instantiating a ``ClientSession``:
202206
If you do not specify the ``defaultTimeout``, the driver uses the timeout
203207
value set on the parent ``MongoClient``.
204208

205-
You can also set a transaction-level timeout by using the ``timeout()``
209+
You can also set a transaction-level timeout by calling the ``timeout()``
206210
method when building a ``TransactionOptions`` instance. Setting this
207211
option applies a timeout to all operations performed in the scope of the
208212
transaction:
209213

210-
.. literalinclude:: /includes/connect/CSOT.java
214+
.. literalinclude:: /includes/connect/CsotExample.java
211215
:language: java
212216
:start-after: start-txn-timeout
213217
:end-before: end-txn-timeout
@@ -221,17 +225,17 @@ Client Encryption
221225
When you use Client-Side Field Level Encryption (CSFLE), the driver uses the
222226
``timeoutMS`` option to limit the time allowed for encryption and decryption
223227
operations. You can set a timeout option for your ``ClientEncryption``
224-
instance by using the ``timeout()`` method when building a
228+
instance by calling the ``timeout()`` method when building a
225229
``ClientEncryptionSettings`` instance.
226230

227231
If you specify the timeout when you construct a
228-
``ClientEncryption`` instance, it controls the lifetime of all operations
232+
``ClientEncryption`` instance, the timeout controls the lifetime of all operations
229233
performed on that instance. If you do not provide a timeout when
230234
instantiating ``ClientEncryption``, the instance
231235
inherits the timeout setting from the ``MongoClient`` used in the
232236
``ClientEncryption`` constructor.
233237

234-
If you set ``timeoutMS`` on both the client and directly in
238+
If you set ``timeoutMS`` both on the client and directly in
235239
``ClientEncryption``, the value provided to ``ClientEncryption`` takes
236240
precedence.
237241

@@ -261,10 +265,10 @@ Cursor Lifetime Mode
261265
~~~~~~~~~~~~~~~~~~~~
262266

263267
The cursor lifetime mode uses the timeout setting to limit the entire lifetime of a
264-
cursor. In this mode, the initialization of the cursor and all subsequent calls
265-
to the cursor methods must complete within the limit specified by the
266-
timeout option. All documents must be returned within this limit.
267-
Otherwise, the cursor's lifetime expires and a timeout error occurs.
268+
cursor. In this mode, your application must initialize the cursor, complete
269+
all calls to the cursor methods, and return all documents within the specified
270+
time limit. Otherwise, the cursor's lifetime expires and the driver
271+
raises a timeout error.
268272

269273
When you close a cursor by calling the ``close()`` method, the
270274
timeout resets for the ``killCursors`` command to ensure server-side resources are
@@ -274,7 +278,7 @@ The following example shows how to set a cursor timeout to ensure that
274278
the cursor is initialized and all documents are retrieved within the
275279
inherited timeout:
276280

277-
.. literalinclude:: /includes/connect/CSOT.java
281+
.. literalinclude:: /includes/connect/CsotExample.java
278282
:language: java
279283
:start-after: start-cursor-lifetime
280284
:end-before: end-cursor-lifetime
@@ -294,7 +298,7 @@ The following code example iterates over documents in the ``db.people`` collecti
294298
by using a cursor with the ``ITERATION`` timeout mode, and then retrieves
295299
and prints the ``name`` field value for each document:
296300

297-
.. literalinclude:: /includes/connect/CSOT.java
301+
.. literalinclude:: /includes/connect/CsotExample.java
298302
:language: java
299303
:start-after: start-cursor-iteration
300304
:end-before: end-cursor-iteration

source/crud/query-documents/cursor.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Access Data From a Cursor
1313
Overview
1414
--------
1515

16-
In this guide, you can learn how to access data using a **cursor** in
16+
In this guide, you can learn how to access data by using a **cursor** in
1717
the {+driver-short+}.
1818

1919
A cursor is a mechanism that allows an application to iterate over database
@@ -38,9 +38,9 @@ to see by setting parameters through methods.
3838

3939
.. tip:: Cursor Timeout
4040

41-
You can set a timeout to limit the amount of time it takes to
42-
retrieve data from a cursor. To learn more, see the
43-
:ref:`java-csot-cursor` section of the Limit Server Execution Time guide.
41+
You can set a timeout on your cursor to return query results.
42+
To learn more, see the :ref:`java-csot-cursor` section of the Limit
43+
Server Execution Time guide.
4444

4545
Terminal Methods
4646
----------------

source/crud/transactions.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ documentation <api-docs-transaction>` to learn more about these methods.
127127

128128
.. tip:: Transaction Timeout
129129

130-
You can set a timeout to limit the amount of time it takes operations
130+
You can set a limit on amount of time that operations can take
131131
to complete in your transactions. To learn more, see the
132132
:ref:`java-csot-txn` section of the Limit Server Execution Time guide.
133133

source/includes/connect/CSOT.java renamed to source/includes/connect/CsotExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.bson.Document;
1717

1818

19-
public class csot {
19+
public class CsotExample {
2020

2121
public static void main(String[] args) {
2222
MongoClient mongoClient = new csot().mongoClientSettings();

0 commit comments

Comments
 (0)