Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmarie17 committed Dec 18, 2024
1 parent 74770f0 commit d87f15c
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions source/fundamentals/connection/csot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To specify a timeout when connecting to a MongoDB deployment, set the
``timeoutMS`` connection option to the timeout length in milliseconds.

The following code example uses the ``timeoutMS`` option to specify a timeout of
10 seconds when instatiating a new ``MongoClient`` instance:
10 seconds when instantiating a new ``MongoClient`` instance:

.. code-block:: javascript

Expand All @@ -70,7 +70,7 @@ following options:
If you specify the ``timeoutMS`` option, the driver automatically applies the
specified timeout to each server operation. The following code example specifies
a timeout limit of 10 seconds at the collection level, then calls the
``insertOne`` method.
``insertOne()`` method.

.. literalinclude:: /code-snippets/connection/csot-operation.js
:language: javascript
Expand All @@ -84,28 +84,25 @@ When you specify a ``timeoutMS`` option, the driver applies the timeout
according to the same inheritance behaviors as other {+driver-short+} options.
The following list describes how the timeout value is inherited:

- **Operation Level**: The operation-level ``timeoutMS`` option takes the
highest precedence and will override this option set at any other layer.
- **Operation Level**: Takes the highest precedence and will override this
option set at any other layer.

- **Transaction Level**: The transaction-level ``timeoutMS`` option takes
precedence over ``timeoutMS`` set at the session, collection, database, or
client level.
- **Transaction Level**: Takes precedence over ``timeoutMS`` set at the session,
collection, database, or client level.

- **Session Level**: The session-level ``timeoutMS`` option inherits down to all
transactions and operations within that session, unless the option is
overriden by options set at those levels.
- **Session Level**: Inherits down to all transactions and operations within
that session, unless the option is overridden by options set at those levels.

- **Collection Level**: The collection-level ``timeoutMS`` option inherits down
to all sessions nad operations on that collection, unless the option is overriden.
- **Collection Level**: Inherits down to all sessions and operations on that
collection, unless the option is overridden.

- **Database Level**: The database-level ``timeoutMS`` option applies to all
collections within that database. It is inherited by all sessions,
collections, and operations within the collections on that database, unless
the option is overriden.
- **Database Level**: Applies to all collections within that database. It is
inherited by all sessions, collections, and operations within the collections
on that database, unless the option is overridden.

- **Client Level**: The client-level ``timeoutMS`` option applies to all
databases, collections, sessions, transactions, and operations within that
client that do not otherwise specify ``timeoutMS``.
- **Client Level**: Applies to all databases, collections, sessions,
transactions, and operations within that client that do not otherwise specify
``timeoutMS``.

For more information on overrides and specific options, see the :ref:`Overrides
<node-csot-overrides>` section.
Expand All @@ -118,7 +115,7 @@ Overrides
The Node.js driver supports various levels of configuration to control the
behavior and performance of database operations.

You can specify a ``timoutMS`` option at the operation level to override the
You can specify a ``timeoutMS`` option at the operation level to override the
client-level configuration for a specific operation. This allows you to
customize timeouts based on the needs of individual queries.

Expand Down Expand Up @@ -181,8 +178,8 @@ Cursor Lifetime Mode

The ``cursorLifetime`` mode uses ``timeoutMS`` to bound the entire lifetime of a
cursor. This is the default timeout mode for non-tailable cursors (for example,
``find``, ``aggregate``, ``listCollections``). In this mode, the initialization
of the cursor and all subsequent ``getMore`` calls must finish within the limit
``find()``, ``aggregate()``, ``listCollections()``). In this mode, the initialization
of the cursor and all subsequent ``getMore()`` calls must finish within the limit
specified with ``timeoutMS``. If they do not, the system throws a timeout error.

Closing a cursor, either as part of a ``toArray()`` call or manually using the
Expand All @@ -198,9 +195,9 @@ of all documents occur within 10 seconds, as shown in the following example:
Cursor Iteration Mode
~~~~~~~~~~~~~~~~~~~~~

The iteration mode uses ``timeoutMS`` to bind each ``next``, ``hasNext``, or
``tryNext`` call. The timeout refreshes after each call completes. This is the
default mode for all tailable cursors, such as tailable ``find`` cursors on
The iteration mode uses ``timeoutMS`` to bind each ``next()``, ``hasNext()``, or
``tryNext()`` call. The timeout refreshes after each call completes. This is the
default mode for all tailable cursors, such as tailable find cursors on
capped collections or change streams.

The cursor continues to fetch new documents as they are added to a collection,
Expand Down

0 comments on commit d87f15c

Please sign in to comment.