- Reference >
- Database Commands >
- Query and Write Operation Commands >
- parallelCollectionScan
parallelCollectionScan¶
On this page
-
parallelCollectionScan¶ New in version 2.6.
Allows applications to use multiple parallel cursors when reading all the documents from a collection, thereby increasing throughput. The
parallelCollectionScancommand returns a document 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 may return fewer cursors than requested.
The command has the following syntax:
The
parallelCollectionScancommand takes the following fields:Field Type Description parallelCollectionScanstring The name of the collection. numCursorsinteger The maximum number of cursors to return. Must be between 1 and 10000, inclusive. parallelCollectionScanis only available formongod, and it cannot operate on a sharded cluster.
Output¶
The parallelCollectionScan command returns a document
containing the array of cursor information:
-
parallelCollectionScan.cursors¶ An array with one or more cursors returned with the command.
-
parallelCollectionScan.cursors.cursor¶ For each cursor returned, a document with details about the cursor.
-
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 cursor batches.
-
parallelCollectionScan.cursors.cursor.ns¶ The namespace for each cursor.
-
parallelCollectionScan.cursors.cursor.id¶ The unique id for each cursor.
-
parallelCollectionScan.cursors.ok¶ The status of each cursor returned with the command.
-
parallelCollectionScan.ok¶ A value of
1indicates theparallelCollectionScancommand succeeded. A value of0indicates an error.