Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mongocollection.parallelcollectionscan(3) [php man page]

MONGOCOLLECTION.PARALLELCOLLECTIONSCAN(3)				 1				 MONGOCOLLECTION.PARALLELCOLLECTIONSCAN(3)

MongoCollection::parallelCollectionScan - Returns an array of cursors to iterator over a full collection in parallel

SYNOPSIS
public array[MongoCommandCursor] MongoCollection::parallelCollectionScan (int $num_cursors) DESCRIPTION
This method returns an array of a maximum of num_cursors cursors. An iteration over one of the returned cursors results in a partial set of documents for a collection. Iteration over all the returned cursors results in getting every document back from the collection. This method is a wrapper for the parallelCollectionScan MongoDB command. PARAMETERS
o $num_cursors - The number of cursors to request from the server. Please note, that the server can return less cursors than you requested. RETURN VALUES
Returns an array of MongoCommandCursor objects. EXAMPLES
Example #1 MongoCollection.parallelCollectionScan(3) example Returning all documents in a collection by using multiple cursors. <?php $m = new MongoClient; $c = $m->demo->cities; /* Request three cursors */ $cursors = $c->parallelCollectionScan( 3 ); /* Add all the cursors to the MultipleIterator */ $mi = new MultipleIterator( MultipleIterator::MIT_NEED_ANY ); foreach ( $cursors as $cursor ) { $mi->attachIterator( $cursor ); } /* Iterate over all the associated cursors */ foreach ( $mi as $items ) { foreach ( $items as $item ) { if ( $item !== NULL ) { echo $item['name'], " "; } } } ?> SEE ALSO
MultipleIterator, MongoCommandCursor, MongoDB::command. PHP Documentation Group MONGOCOLLECTION.PARALLELCOLLECTIONSCAN(3)

Check Out this Related Man Page

MONGOCOMMANDCURSOR.__CONSTRUCT(3)					 1					 MONGOCOMMANDCURSOR.__CONSTRUCT(3)

MongoCommandCursor::__construct - Create a new command cursor

SYNOPSIS
public MongoCommandCursor::__construct (MongoClient $connection, string $ns, array $command = array()) DESCRIPTION
Generally, you should not have to construct a MongoCommandCursor manually, as there are helper functions such as MongoCollection::aggre- gateCursor and MongoCollection::parallelCollectionScan; however, if the server introduces new commands that can return cursors, this con- structor will be useful in the absence of specific helper methods. You may also consider using MongoCommandCursor::createFromDocument. PARAMETERS
o $connection - Database connection. o $ns - Full name of the database and collection (e.g. "test.foo") o $command - Database command. RETURN VALUES
Returns the new cursor. EXAMPLES
Example #1 MongoCommandCursor example <?php $m = new MongoClient; // Define the aggregation pipeline $pipeline = [ [ '$group' => [ '_id' => '$country_code', 'timezones' => [ '$addToSet' => '$timezone' ] ] ], [ '$sort' => [ '_id' => 1 ] ], ]; // Construct a MongoCommandCursor object $cursor = new MongoCommandCursor( $m, // MongoClient object 'demo.cities', // namespace [ 'aggregate' => 'cities', 'pipeline' => $pipeline, 'cursor' => [ 'batchSize' => 0 ], ] ); foreach($cursor as $result) { } ?> SEE ALSO
MongoCommandCursor.createFromDocument(3), MongoCollection.aggregateCursor(3), MongoCollection.parallelCollectionScan(3). PHP Documentation Group MONGOCOMMANDCURSOR.__CONSTRUCT(3)
Man Page