Skip to content

Commit b2093d0

Browse files
[Backport v5.3] DOCSP-47826 Clarify batchSize (#117)
Co-authored-by: lindseymoore <[email protected]>
1 parent 355ff4c commit b2093d0

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

source/read/change-streams.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,14 @@ customize its behavior:
163163

164164
* - ``batchSize()``
165165
- | Specifies the maximum number of change events to return in each batch of the
166-
response from the MongoDB cluster.
166+
response from the MongoDB cluster. By default, returns an initial batch size
167+
of ``101`` documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch.
168+
This option can enforce a smaller limit than 16 MiB, but not a larger one. If you set
169+
``batchSize`` to a limit that results in batches larger than 16 MiB, this
170+
option has no effect.
171+
172+
| A ``batchSize`` of ``0`` means that the cursor will be established, but no documents
173+
will be returned in the first batch.
167174

168175
* - ``collation()``
169176
- | Specifies the collation to use for the change stream cursor.

source/read/cursors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cursors reduce both memory consumption and network bandwidth usage.
2929

3030
In the {+driver-short+}, some streams are backed by cursors. The size of batches used
3131
in these underlying cursors depends on the demand requested on the ``Subscription`` for the
32-
``Publisher``. The batch size of data contained by each underlying cursor can be set by
32+
``Publisher``. You can set the batch size of data contained by each underlying cursor by
3333
using the ``FindPublisher.batchSize()`` method.
3434

3535
Sample Data

source/read/distinct.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ The following table describes some methods you can use to customize the
113113
- Description
114114

115115
* - ``batchSize()``
116-
- | Sets the number of documents to return per batch.
116+
- | Sets the number of documents to return per batch. By default, returns an initial batch size
117+
of ``101`` documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch.
118+
This option can enforce a smaller limit than 16 MiB, but not a larger one.
119+
120+
| A ``batchSize`` of ``0`` means that the cursor will be established, but no documents
121+
will be returned in the first batch.
117122

118123
* - ``collation()``
119124
- | Specifies the kind of language collation to use when sorting

source/read/retrieve-data.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,14 @@ to it. The following table describes commonly used methods:
129129
- Description
130130

131131
* - ``batchSize(int batchSize)``
132-
- | Limits the number of documents to hold in a cursor at a given time. To
133-
learn more about cursors, see :manual:`cursor
134-
</reference/glossary/#std-term-cursor>` in the MongoDB Server documentation.
132+
- | The maximum number of documents within each batch returned in a query result. By default, the ``find``
133+
command has an initial batch size of ``101`` documents and a maximum size of 16 mebibytes (MiB)
134+
for each subsequent batch. This option can enforce a smaller limit than 16 MiB, but not a larger
135+
one. If you set ``batchSize`` to a limit that results in batches larger than
136+
16 MiB, this option has no effect.
137+
138+
| A ``batchSize`` of ``0`` means that the cursor will be established, but no documents
139+
will be returned in the first batch.
135140

136141
* - ``collation(Collation collation)``
137142
- | Sets the collation options as an instance of the ``Collation`` class.

0 commit comments

Comments
 (0)