Skip to content

Commit 33a06c9

Browse files
committed
Merge pull request mongodb#215 from shuangela/DOCSP-47835-clarify-batchsize
DOCSP-47835 Clarify batchsize behavior
1 parent 82a1ac7 commit 33a06c9

5 files changed

+35
-28
lines changed

source/includes/extracts-watch-option.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
ref: watch-option-batchSize
22
content: |
3-
Specifies the batch size for the cursor, which will apply to both the initial
4-
``aggregate`` command and any subsequent ``getMore`` commands. This determines
5-
the maximum number of change events to return in each response from the
6-
server.
3+
The maximum number of documents within each batch returned in a change stream, which applies
4+
to the ``aggregate`` command. By default, the ``aggregate`` command has an initial batch size of
5+
``101`` documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch. This
6+
option can enforce a smaller limit than 16 MiB, but not a larger one. If you set ``batchSize``
7+
to a limit that results in batches larger than 16 MiB, this option has no effect.
78
89
Irrespective of the ``batchSize`` option, the initial ``aggregate`` command
910
response for a change stream generally does not include any documents

source/read/retrieve.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ you can set in the array:
180180
- Description
181181

182182
* - ``batchSize``
183-
- | The number of documents to return per batch. The default value is ``101``.
183+
- | The maximum number of documents within each batch returned in a query result. By default,
184+
the ``find`` command has an initial batch size of ``101`` documents
185+
and a maximum size of 16 mebibytes (MiB) for each subsequent batch. This
186+
option can enforce a smaller limit than 16 MiB, but not a larger
187+
one. If you set ``batchSize`` to a limit that results in batches larger than
188+
16 MiB, this option has no effect.
184189
| **Type**: ``integer``
185190

186191
* - ``collation``

source/reference/method/MongoDBCollection-find.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ Parameters
5454

5555
* - batchSize
5656
- integer
57-
- The number of documents to return in the first batch. Defaults to
58-
``101``. A batchSize of ``0`` means that the cursor will be
59-
established, but no documents will be returned in the first batch.
57+
- The maximum number of documents within each batch returned in a query result. By default, the ``find``
58+
command has an initial batch size of ``101`` documents and a maximum size of 16 mebibytes (MiB)
59+
for each subsequent batch. This option can enforce a smaller limit than 16 MiB, but not a larger
60+
one. If you set ``batchSize`` to a limit that results in batches larger than
61+
16 MiB, this option has no effect.
62+
63+
A batchSize of ``0`` means that the cursor will be established, but no documents
64+
will be returned in the first batch.
6065

6166
Unlike the previous wire protocol version, a batchSize of ``1`` for the
6267
:dbcommand:`find` command does not close the cursor.

source/reference/method/MongoDBCollection-listSearchIndexes.txt

+6-10
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,12 @@ Parameters
4141

4242
* - batchSize
4343
- integer
44-
- Specifies the batch size for the cursor, which will apply to both the
45-
initial ``aggregate`` command and any subsequent ``getMore`` commands.
46-
This determines the maximum number of documents to return in each
47-
response from the server.
48-
49-
A batchSize of ``0`` is special in that and will only apply to the
50-
initial ``aggregate`` command; subsequent ``getMore`` commands will use
51-
the server's default batch size. This may be useful for quickly
52-
returning a cursor or failure from ``aggregate`` without doing
53-
significant server-side work.
44+
- The maximum number of documents within each batch returned in the indexes list, which applies
45+
to the ``aggregate`` command. By default, the ``aggregate`` command has an initial batch size of
46+
``101`` documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch. This
47+
option can enforce a smaller limit than 16 MiB, but not a larger
48+
one. If you set ``batchSize`` to a limit that results in batches larger than
49+
16 MiB, this option has no effect.
5450

5551
* - codec
5652
- MongoDB\\Codec\\DocumentCodec

source/reference/method/MongoDBDatabase-aggregate.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ Parameters
5555

5656
* - batchSize
5757
- integer
58-
- Specifies the batch size for the cursor, which will apply to both the
59-
initial ``aggregate`` command and any subsequent ``getMore`` commands.
60-
This determines the maximum number of documents to return in each
61-
response from the server.
62-
63-
A batchSize of ``0`` is special in that and will only apply to the
64-
initial ``aggregate`` command; subsequent ``getMore`` commands will use
65-
the server's default batch size. This may be useful for quickly
66-
returning a cursor or failure from ``aggregate`` without doing
67-
significant server-side work.
58+
- The maximum number of documents within each batch returned in a query result.
59+
By default, the ``aggregate`` command has an initial batch size of
60+
``101`` documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch. This
61+
option can enforce a smaller limit than 16 MiB, but not a larger
62+
one. If you set ``batchSize`` to a limit that results in batches larger than
63+
16 MiB, this option has no effect.
64+
65+
A batchSize of ``0`` means that the cursor will be established, but no documents
66+
will be returned in the first batch. This may be useful for quickly returning a cursor
67+
or failure from ``aggregate`` without doing significant server-side work.
6868

6969
* - bypassDocumentValidation
7070
- boolean

0 commit comments

Comments
 (0)