-
Notifications
You must be signed in to change notification settings - Fork 34
DOCSP-47835 Clarify batchsize behavior #215
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
Changes from 6 commits
4d29070
bf79b9e
b02a39a
248115f
6f46523
a7bd71c
269819f
76d9bd5
69d3ed4
c18ef44
e9aab32
6183d86
89b304c
635e787
debcfe1
380a16e
892f7ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,7 +180,12 @@ you can set in the array: | |
- Description | ||
|
||
* - ``batchSize`` | ||
- | The number of documents to return per batch. The default value is ``101``. | ||
- | The maximum number of documents within each batch returned in a query result. By default, | ||
the ``find()`` method has an initial batch size of ``101`` documents | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this section is talking about both Therefore, this snippet will just duplicate the first paragraph from the |
||
and a maximum of 16 megabytes for each subsequent batch. This | ||
option can enforce a smaller limit than 16 megabytes, but not a larger | ||
one. If you set ``batchSize`` to a limit that results in batches larger than | ||
16 MB, this option has no effect. | ||
| **Type**: ``integer`` | ||
|
||
* - ``collation`` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,9 +52,12 @@ Parameters | |
|
||
* - batchSize | ||
- integer | ||
- 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The special behavior of |
||
- The maximum number of documents within each batch returned in a query result. By default, | ||
the ``find()`` method has an initial batch size of ``101`` documents | ||
and a maximum of 16 megabytes for each subsequent batch. This | ||
option can enforce a smaller limit than 16 megabytes, but not a larger | ||
one. If you set ``batchSize`` to a limit that results in batches larger than | ||
16 MB, this option has no effect. | ||
|
||
Unlike the previous wire protocol version, a batchSize of ``1`` for the | ||
:dbcommand:`find` command does not close the cursor. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,11 +54,13 @@ Parameters | |
|
||
* - batchSize | ||
- integer | ||
- Specifies the batch size for the cursor, which will apply to both the | ||
initial ``aggregate`` command and any subsequent ``getMore`` commands. | ||
This determines the maximum number of documents to return in each | ||
response from the server. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can discuss There is also a special directive in the CRUD spec for drivers to intentionally omit |
||
|
||
- The maximum number of documents within each batch returned in a query result. By default, | ||
the ``find()`` method has an initial batch size of ``101`` documents | ||
and a maximum of 16 megabytes for each subsequent batch. This | ||
option can enforce a smaller limit than 16 megabytes, but not a larger | ||
one. If you set ``batchSize`` to a limit that results in batches larger than | ||
16 MB, this option has no effect. | ||
|
||
A batchSize of ``0`` is special in that and will only apply to the | ||
initial ``aggregate`` command; subsequent ``getMore`` commands will use | ||
the server's default batch size. This may be useful for quickly | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change streams have nothing to do with the
find()
method. I think we should preserve the original wording that referred toaggregate
and "change events", since this is a snippet forwatch()
methods.These use the
aggregate
command and$changeStream
stage. A batch size foraggregate
is expressed via thecursor.batchSize
option on the outgoing command. ForgetMore
commands (common to bothaggregate
andfind
),batchSize
is a top-level option.In the interest of correctness and consistency (with other docs), we should refer to "mebibytes" or "MiB" instead of "megabytes" and "MB".
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding on to this, I think it'd be more technically correct to refer to "
aggregate
command" instead of "watch()
method". That helps communicate to users that this driver method is actually running anaggregate
command on the server, and I think it's helpful since they can then cross-reference with the server's own API docs for commands.I understand this might not be desirable in prose-style docs (e.g.
read/retrieve.txt
), but this snippet is included in our API reference.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, left a question above about MB vs MiB but saw you already answered it here! Feel free to ignore.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmikola For clarification, in this comment "Adding on to this, I think it'd be more technically correct to refer to "
aggregate
command" instead of "watch()
method". That helps communicate to users that this driver method is actually running an aggregate command on the server, and I think it's helpful since they can then cross-reference with the server's own API docs for commands," when you say the "watch()
method" did you mean the "find()
method"? I don't think this doc refers to the watch() method. Just wanted to clarify to be sure I'm understanding correctly!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is
extracts-watch-option.yaml
and included in the docs forwatch()
methods on Client, Database, and Collection objects.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I think I misunderstood the comment and understand what you're saying now. Thanks for the help!