diff --git a/source/reference/command/find.txt b/source/reference/command/find.txt index ad45b25c44..c37b90e06d 100644 --- a/source/reference/command/find.txt +++ b/source/reference/command/find.txt @@ -132,9 +132,15 @@ The command accepts the following fields: * - ``batchSize`` - non-negative integer - - Optional. The number of documents to return in the first batch. - Defaults to 101. A batchSize of 0 means that the cursor will be - established, but no documents will be returned in the first batch. + - Optional. The maximum number of documents that can be returned in each batch of a + query result. By default, the ``find`` command has an initial ``batchSize`` of + the lesser of ``101`` documents or 16 mebibytes (MiB) worth of documents. + Subsequent batches have a maximum size of 16 MiB. This option can enforce a smaller + limit than 16 MiB, but not a larger one. When set, the ``batchSize`` is the lesser + of ``batchSize`` documents or 16 MiB worth of documents. + + A ``batchSize`` of ``0`` means that the cursor is established, + but no documents are returned in the first batch. Unlike the previous wire protocol version, a batchSize of 1 for the :dbcommand:`find` command does not close the cursor. diff --git a/source/reference/command/getMore.txt b/source/reference/command/getMore.txt index c5fa0fbfbd..7d7cd07546 100644 --- a/source/reference/command/getMore.txt +++ b/source/reference/command/getMore.txt @@ -72,11 +72,11 @@ The command accepts the following fields: * - ``batchSize`` - positive integer - - Optional. The number of documents to return in the batch. + - Optional. The maximum number of documents that can be returned in each batch of a query result. - If ``batchSize`` is not set, ``getMore`` returns up to 16 - mebibytes of data. If ``batchSize`` is set, ``getMore`` returns - the smaller of 16 mebibytes of data or ``batchSize`` documents. + If ``batchSize`` is not set, ``getMore`` returns up to 16 mebibytes (MiB) of data in all + subsequent batches. If ``batchSize`` is set, ``getMore`` returns + the lesser of ``batchSize`` documents or 16 MiB worth of documents. * - ``maxTimeMS`` - non-negative integer diff --git a/source/reference/method/cursor.batchSize.txt b/source/reference/method/cursor.batchSize.txt index 31555c04ca..d10609a396 100644 --- a/source/reference/method/cursor.batchSize.txt +++ b/source/reference/method/cursor.batchSize.txt @@ -19,12 +19,14 @@ Definition .. include:: /includes/fact-mongosh-shell-method.rst - Specifies the - number of documents to return in each batch of the response from the - MongoDB instance. In most cases, modifying the batch size will - not affect the user or the application, as :binary:`~bin.mongosh` and - most :driver:`drivers ` return results as if MongoDB returned a - single batch. + The maximum number of documents that can be returned in each batch of a query result. + By default, the initial batch size is the lesser of ``101`` documents or 16 mebibytes (MiB) worth of + documents. Subsequent batches have a maximum size of 16 MiB. This option + can enforce a smaller limit than 16 MiB, but not a larger one. When set, the ``batchSize`` is the lesser + of ``batchSize`` documents or 16 MiB worth of documents. + + A ``batchSize`` of ``0`` means that the cursor is established, but no documents + are returned in the first batch. .. note:: @@ -51,10 +53,12 @@ Definition * - ``size`` - integer - - The initial number of documents to return for a batch. The - default initial batch size is 101 documents. Subsequent - batches are 16 mebibytes. The default applies to drivers and - Mongo Shell. For details, see :ref:`cursor-batches`. + - The maximum number of documents that can be returned in each batch of a query result. The + default initial batch size is the lesser or ``101`` documents or 16 mebibytes + (MiB) worth of documents. Subsequent batches have a maximum size of 16 MiB. This + option can enforce a smaller limit than 16 MiB, but not a larger one. The + default applies to drivers and Mongo Shell. For details, see + :ref:`cursor-batches`. Compatibility ------------- diff --git a/source/reference/method/db.collection.watch.txt b/source/reference/method/db.collection.watch.txt index 5274b70f58..684f594791 100644 --- a/source/reference/method/db.collection.watch.txt +++ b/source/reference/method/db.collection.watch.txt @@ -115,13 +115,17 @@ Definition * - ``batchSize`` - int - - Optional. Specifies the maximum number of change events to return in each - batch of the response from the MongoDB cluster. + - Optional. The maximum number of documents that can be returned in each batch of + a change stream. By default, :method:`~db.collection.watch()` has an initial + batch size of the lesser of ``101`` documents or 16 mebibytes (MiB) worth of + documents. Subsequent batches have a maximum size of 16 mebibytes.This option + can enforce a smaller limit than 16 MiB, but not a larger one. When set, the + ``batchSize`` is the lesser of ``batchSize`` documents or 16 MiB worth of + documents. Has the same functionality as :method:`cursor.batchSize()`. - * - ``maxAwaitTimeMS`` - int diff --git a/source/reference/operator/aggregation/queryStats.txt b/source/reference/operator/aggregation/queryStats.txt index c63e2023c3..7d097b0243 100644 --- a/source/reference/operator/aggregation/queryStats.txt +++ b/source/reference/operator/aggregation/queryStats.txt @@ -354,9 +354,13 @@ Each document in the output array contains the following fields: * - ``key.batchSize`` - String - Normalized - - The :ref:`batch size ` for the key. Batch size - specifies the number of documents to return in each batch of the - response from the MongoDB instance. + - The :ref:`batch size ` for the key. Batch size + specifies the maximum number of documents that can be returned in each batch of a query + result. By default, the initial batch size is the lesser of ``101`` documents or 16 + mebibytes (MiB) worth of documents. Subsequent batches have a maximum size of 16 MiB. ``batchSize`` can enforce a + smaller limit than 16 MiB, but not a larger one. When set, the + ``batchSize`` is the lesser of ``batchSize`` documents or 16 MiB worth of + documents. * - ``key.comment`` - String