Skip to content

Commit f3cce81

Browse files
authored
Merge pull request #215 from shuangela/DOCSP-47835-clarify-batchsize
DOCSP-47835 Clarify batchsize behavior
2 parents 619e955 + 892f7ea commit f3cce81

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
@@ -52,9 +52,14 @@ Parameters
5252

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

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

source/reference/method/MongoDBCollection-listSearchIndexes.txt

+6-10
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,12 @@ Parameters
4040

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

5450
* - codec
5551
- 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)