From 8e5a91bf87a99a2558b24d095b245410b7decf37 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 17 Apr 2014 12:37:40 +0000 Subject: [PATCH] PHP-1043: Document parallelCollectionScan git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@333361 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../parallelcollectionscan.xml | 122 ++++++++++++++++++ reference/mongo/versions.xml | 1 + 2 files changed, 123 insertions(+) create mode 100644 reference/mongo/mongocollection/parallelcollectionscan.xml diff --git a/reference/mongo/mongocollection/parallelcollectionscan.xml b/reference/mongo/mongocollection/parallelcollectionscan.xml new file mode 100644 index 0000000000..187ec81126 --- /dev/null +++ b/reference/mongo/mongocollection/parallelcollectionscan.xml @@ -0,0 +1,122 @@ + + + + + + MongoCollection::parallelCollectionScan + Returns an array of cursors to iterator over a full collection in parallel + + + &reftitle.description; + + public array[MongoCommandCursor]MongoCollection::parallelCollectionScan + intnum_cursors + + + 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. + + + + + &reftitle.parameters; + + + + + num_cursors + + + + The number of cursors to request from the server. Please note, that the + server can return less cursors than you requested. + + + + + + + + + &reftitle.returnvalues; + + Returns an array of MongoCommandCursor objects. + + + + + &reftitle.examples; + + <function>MongoCollection::parallelCollectionScan</function> example + + Returning all documents in a collection by using multiple cursors. + + +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'], "\n"; + } + } +} +?> +]]> + + + + + + &reftitle.seealso; + + + MultipleIterator + MongoCommandCursor + MongoDb::command + + + + + diff --git a/reference/mongo/versions.xml b/reference/mongo/versions.xml index d0951461b0..4cb0dc08d3 100644 --- a/reference/mongo/versions.xml +++ b/reference/mongo/versions.xml @@ -97,6 +97,7 @@ +