Skip to content

Commit 9a22092

Browse files
author
Sam Kleinman
committed
edits: DOCS-579
1 parent 0de1082 commit 9a22092

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

source/reference/method/cursor.batchSize.txt

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,42 @@ cursor.batchSize()
77
.. method:: cursor.batchSize()
88

99
The :method:`batchSize() <cursor.batchSize()>` method specifies the
10-
number of documents the cursor returns per batch. Specifying the
11-
batchSize is a low-level optimization whose effects are not visible
12-
to the user.
10+
number of documents the cursor will return in each batch. In most
11+
cases, the effect of configuring the batch size will not affect the
12+
user or application.
1313

1414
The :method:`batchSize() <cursor.batchSize()>` method takes the
1515
following parameter:
1616

17-
:param size:
18-
19-
The number of documents to return per batch. The ``size``
17+
:param size:
18+
19+
The number of documents to return per batch. This value
2020
also affects whether to close the cursor after the first
2121
batch. Refer to the specific driver ``batchSize``
2222
documentation for the cursor behavior as determined by the
2323
``size``.
2424

25-
.. note::
26-
27-
The actual number of documents in the batch may be smaller as
28-
determined by the limit or the 4 megabyte size limit of the
29-
server reply.
30-
31-
Consider the following examples of the :method:`batchSize()
25+
The :program:`mongo` shell will iterate over 20 documents
26+
regardless of the configured batch size, unless you specify a
27+
negative batch size.
28+
29+
Consider the following examples that use the :method:`batchSize()
3230
<cursor.batchSize()>` method in the :program:`mongo` shell:
33-
31+
3432
- Set the number of documents returned by the :method:`find()
3533
<db.collection.find()>` method to ``10`` per each batch:
36-
34+
3735
.. code-block:: javascript
3836

3937
var curs = db.animals.find().batchSize(10)
40-
38+
4139
The cursor remains open so that you can iterate through the cursor
4240
``curs`` to access all documents in the ``animals`` collection.
4341

4442
- Set the number of documents returned by the :method:`find()
4543
<db.collection.find()>` method to ``10`` per each batch and close
4644
after the first batch:
47-
45+
4846
.. code-block:: javascript
4947

5048
var curs = db.animals.find().batchSize(-10)

0 commit comments

Comments
 (0)