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.
- This command will not return more than one cursor for the WiredTiger storage engine.
The command has the following syntax:
parallelCollectionScancommand takes the following fields:
Field Type Description
string The name of the collection.
integer The maximum number of cursors to return. Must be between 1 and 10000, inclusive.
Optional. Specifies the read concern.
The readConcern option has the following syntax:
Changed in version 3.6.
Possible read concern levels are:
"local". This is the default read concern level.
"available". This is the default for reads against secondaries when Read Operations and Causally Consistent Sessions and “level” are unspecified. The query returns the instance’s most recent data.
"majority". Available for replica sets that use WiredTiger storage engine.
"linearizable". Available for read operations on the
For more formation on the read concern levels, see Read Concern Levels.
"majority"read concern level, you can specify the
afterClusterTimeoption to have the read operation return data that meets the level requirement and the specified after cluster time requirement. For more information, see Read Operations and Causally Consistent Sessions.
Optional. Specifies a time limit in milliseconds for processing operations on a cursor. If you do not specify a value for maxTimeMS, operations will not time out. A value of
0explicitly specifies the default unbounded behavior.
To override the default read concern level of
"local", use the
Starting in MongoDB 3.6, support for read concern
"majority"is enabled by default. For MongoDB 3.6.1 - 3.6.x, you can disable read concern
"majority". For more information, see Disable Read Concern Majority.
Regardless of the read concern level, the most recent data on a node may not reflect the most recent version of the data in the system.
parallelCollectionScan command returns a document containing the array of cursor information:
For each cursor returned, a document with details about the cursor.
An empty first batch is useful for quickly returning a cursor or failure message without doing significant server-side work. See cursor batches.
A value of
parallelCollectionScancommand succeeded. A value of
0indicates an error.