Skip to content

document parallelCollectionScan output and use #1873

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/core/cursors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ document more than once if that document has changed. To handle this
situation, see the information on :ref:`snapshot mode
<faq-developers-isolate-cursors>`.

.. _cursor-batches:

Cursor Batches
~~~~~~~~~~~~~~

Expand Down
65 changes: 64 additions & 1 deletion source/reference/command/parallelCollectionScan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ parallelCollectionScan
Allows applications to use multiple parallel cursors when reading
all the documents from a collection, thereby increasing throughput.
The :dbcommand:`parallelCollectionScan` command returns a document
that contains an array of cursor information.
that contains an array of cursor information.

Each cursor provides access to the return of a partial set of documents
from a collection. Iterating each cursor returns every document in the
collection. Cursors do not contain the results of the database command.
The result of the database command identifies the cursors, but does not
contain or constitute the cursors.

The server can return fewer cursors than requested.

The command has the following syntax:

Expand All @@ -26,3 +34,58 @@ parallelCollectionScan
fields:

.. include:: /reference/command/parallelCollectionScan-field.rst

Output
------

The :dbcommand:`parallelCollectionScan` command returns a document
containing the array of cursor information:

.. code-block:: javascript

{
"cursors" : [
{
"cursor" : {
"firstBatch" : [ ],
"ns" : "<database name>.<collection name>",
"id" : NumberLong("155949257847")
},
"ok" : true
}
],
"ok" : 1
}


.. data:: parallelCollectionScan.cursors

An array with one or more cursors returned with the command.

.. data:: parallelCollectionScan.cursors.cursor

For each cursor returned, a document with details about the cursor.

.. data:: parallelCollectionScan.cursors.cursor.firstBatch

An empty first batch is useful for quickly returning a cursor or
failure message without doing significant server-side work. See
:ref:`cursor batches <cursor-batches>`.

.. data:: parallelCollectionScan.cursors.cursor.ns

The namespace for each cursor.

.. data:: parallelCollectionScan.cursors.cursor.id

The unique id for each cursor.

.. data:: parallelCollectionScan.cursors.ok

The status of each cursor returned with the command.

.. data:: parallelCollectionScan.ok

A value of ``1`` indicates the :dbcommand:`parallelCollectionScan`
command succeeded. A value of ``0`` indicates an error.