Skip to content

Commit e8021c0

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-27571-batch-size (#7325) (#7347)
* DOCSP-27571-batch-size * DOCSP-27571-batch-size * DOCSP-27571-batch-size --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent f331284 commit e8021c0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

source/reference/method/cursor.batchSize.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ Definition
1717

1818
.. method:: cursor.batchSize(size)
1919

20-
2120
.. include:: /includes/fact-mongosh-shell-method.rst
2221

23-
2422
Specifies the
2523
number of documents to return in each batch of the response from the
2624
MongoDB instance. In most cases, modifying the batch size will
@@ -29,34 +27,36 @@ Definition
2927
single batch.
3028

3129
The :method:`~cursor.batchSize()` method takes the
32-
following parameter:
33-
30+
following field:
3431

3532
.. list-table::
3633
:header-rows: 1
3734
:widths: 20 20 80
3835

39-
* - Parameter
40-
36+
* - Field
4137
- Type
42-
4338
- Description
4439

4540
* - ``size``
46-
4741
- integer
48-
49-
- The number of documents to return per batch.
42+
- The initial number of documents to return for a batch. The
43+
default initial batch size is 101 documents. Subsequent
44+
batches are 16 megabytes. The default applies to drivers and
45+
Mongo Shell. For details, see :ref:`cursor-batches`.
5046

5147
Example
5248
-------
5349

54-
The following example sets the batch size for the results of a query
55-
(i.e. :method:`~db.collection.find()`) to ``10``. The
56-
:method:`~cursor.batchSize()` method does not change the
57-
output in :binary:`~bin.mongosh`, which, by default, iterates over the
58-
first 20 documents.
50+
The following example sets ``batchSize`` for the results of a query
51+
(specifically, :method:`~db.collection.find()`) to ``10``:
5952

6053
.. code-block:: javascript
6154

6255
db.inventory.find().batchSize(10)
56+
57+
Learn More
58+
----------
59+
60+
- :ref:`cursor-batches`
61+
- :method:`cursor.next()`
62+
- :dbcommand:`getMore`

0 commit comments

Comments
 (0)