- Reference >
mongo
Shell Methods >- Cursor Methods >
- cursor.batchSize()
cursor.batchSize()¶
On this page
Definition¶
-
cursor.
batchSize
(size)¶ Specifies the number of documents to return in each batch of the response from the MongoDB instance. In most cases, modifying the batch size will not affect the user or the application, as the
mongo
shell and most drivers return results as if MongoDB returned a single batch.The
batchSize()
method takes the following parameter:Parameter Type Description size
integer The number of documents to return per batch. Do not use a batch size of 1
.Note
Specifying
1
or a negative number is analogous to using thelimit()
method.