From 83b0744169824d9fca64b077d9a015a6b4898307 Mon Sep 17 00:00:00 2001 From: kay Date: Tue, 16 Oct 2012 12:35:19 -0400 Subject: [PATCH 1/3] DOCS-579 add batchSize() doc --- source/reference/method/cursor.batchSize.txt | 54 ++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 source/reference/method/cursor.batchSize.txt diff --git a/source/reference/method/cursor.batchSize.txt b/source/reference/method/cursor.batchSize.txt new file mode 100644 index 00000000000..34fcda40577 --- /dev/null +++ b/source/reference/method/cursor.batchSize.txt @@ -0,0 +1,54 @@ +================== +cursor.batchSize() +================== + +.. default-domain:: mongodb + +.. method:: cursor.batchSize() + + The :method:`batchSize() ` method specifies the + number of documents the cursor returns per batch. Specifying the + batchSize is a low-level optimization whose effects are not visible + to the user. + + The :method:`batchSize() ` method takes the + following parameter: + + :param size: + + The number of documents to return per batch. The ``size`` + also affects whether to close the cursor after the first + batch. Refer to the specific driver ``batchSize`` + documentation for the cursor behavior as determined by the + ``size``. + + .. note:: + + The actual number of documents in the batch may be smaller as + determined by the limit or the 4 megabyte size limit of the + server reply. + + Consider the following examples of the :method:`batchSize() + ` method in the :program:`mongo` shell: + + - Set the number of documents returned by the :method:`find() + ` method to ``10`` per each batch: + + .. code-block:: javascript + + var curs = db.animals.find().batchSize(10) + + The cursor remains open so that you can iterate through the cursor + ``curs`` to access all documents in the ``animals`` collection. + + - Set the number of documents returned by the :method:`find() + ` method to ``10`` per each batch and close + after the first batch: + + .. code-block:: javascript + + var curs = db.animals.find().batchSize(-10) + + In the :program:`mongo` shell, the cursor closes after the first + batch so that you can iterate the cursor only ``10`` times. + \ No newline at end of file From 19b34c22dabf8f49eeb79d740719ec177164f10c Mon Sep 17 00:00:00 2001 From: kay Date: Tue, 16 Oct 2012 12:37:13 -0400 Subject: [PATCH 2/3] DOCS-579 add batchSize doc --- source/reference/method/cursor.batchSize.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/reference/method/cursor.batchSize.txt b/source/reference/method/cursor.batchSize.txt index 34fcda40577..2275a42bee5 100644 --- a/source/reference/method/cursor.batchSize.txt +++ b/source/reference/method/cursor.batchSize.txt @@ -50,5 +50,4 @@ cursor.batchSize() var curs = db.animals.find().batchSize(-10) In the :program:`mongo` shell, the cursor closes after the first - batch so that you can iterate the cursor only ``10`` times. - \ No newline at end of file + batch so that you can iterate the cursor only ``10`` times. \ No newline at end of file From 4318c7c6a4702577e71a62b6d463f5ada3c7570e Mon Sep 17 00:00:00 2001 From: kay Date: Tue, 16 Oct 2012 12:42:58 -0400 Subject: [PATCH 3/3] DOCS-579 add batchSize doc --- source/reference/method/cursor.batchSize.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference/method/cursor.batchSize.txt b/source/reference/method/cursor.batchSize.txt index 2275a42bee5..12cca244163 100644 --- a/source/reference/method/cursor.batchSize.txt +++ b/source/reference/method/cursor.batchSize.txt @@ -50,4 +50,4 @@ cursor.batchSize() var curs = db.animals.find().batchSize(-10) In the :program:`mongo` shell, the cursor closes after the first - batch so that you can iterate the cursor only ``10`` times. \ No newline at end of file + batch so that you can iterate the cursor only ``10`` times.