Skip to content

DOCSP-47826 Clarify batchSize #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion source/read/change-streams.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ customize its behavior:

* - ``batchSize()``
- | Specifies the maximum number of change events to return in each batch of the
response from the MongoDB cluster.
response from the MongoDB cluster. By default, returns an initial batch size
of ``101`` documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch.
This option can enforce a smaller limit than 16 MiB, but not a larger one. If you set
``batchSize`` to a limit that results in batches larger than 16 MiB, this
option has no effect.

| A ``batchSize`` of ``0`` means that the cursor will be established, but no documents
will be returned in the first batch.

* - ``collation()``
- | Specifies the collation to use for the change stream cursor.
Expand Down
2 changes: 1 addition & 1 deletion source/read/cursors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cursors reduce both memory consumption and network bandwidth usage.

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

Sample Data
Expand Down
7 changes: 6 additions & 1 deletion source/read/distinct.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ The following table describes some methods you can use to customize the
- Description

* - ``batchSize()``
- | Sets the number of documents to return per batch.
- | Sets the number of documents to return per batch. By default, returns an initial batch size
of ``101`` documents and a maximum size of 16 mebibytes (MiB) for each subsequent batch.
This option can enforce a smaller limit than 16 MiB, but not a larger one.

| A ``batchSize`` of ``0`` means that the cursor will be established, but no documents
will be returned in the first batch.

* - ``collation()``
- | Specifies the kind of language collation to use when sorting
Expand Down
11 changes: 8 additions & 3 deletions source/read/retrieve-data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ to it. The following table describes commonly used methods:
- Description

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

| A ``batchSize`` of ``0`` means that the cursor will be established, but no documents
will be returned in the first batch.

* - ``collation(Collation collation)``
- | Sets the collation options as an instance of the ``Collation`` class.
Expand Down
Loading