Man Page: mongocommandcursor.__construct
Operating Environment: php
Section: 3
MONGOCOMMANDCURSOR.__CONSTRUCT(3) 1 MONGOCOMMANDCURSOR.__CONSTRUCT(3) MongoCommandCursor::__construct - Create a new command cursorSYNOPSISpublic MongoCommandCursor::__construct (MongoClient $connection, string $ns, array $command = array())DESCRIPTIONGenerally, 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.PARAMETERSo $connection - Database connection. o $ns - Full name of the database and collection (e.g. "test.foo") o $command - Database command.RETURN VALUESReturns the new cursor.EXAMPLESExample #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 ALSOMongoCommandCursor.createFromDocument(3), MongoCollection.aggregateCursor(3), MongoCollection.parallelCollectionScan(3). PHP Documentation Group MONGOCOMMANDCURSOR.__CONSTRUCT(3)
| Related Man Pages |
|---|
| mongo(3) - php |
| mongocommandcursor(3) - php |
| mongocommandcursor.rewind(3) - php |
| mongocollection.findone(3) - php |
| mongoclient.killcursor(3) - php |
| Similar Topics in the Unix Linux Community |
|---|
| LordsAWar! 0.1.1 (Default branch) |
| LordsAWar! 0.1.2 (Default branch) |
| City 2.0: IT will make cities more engaging and energy-efficient |
| The Risks of Bad Communication |