svn: /phpdoc/en/trunk/reference/mongo/mongocollection/ aggregate.xml

From: Date: Tue, 10 May 2016 18:17:49 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/mongocollection/ aggregate.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-14124@lists.php.net to get a copy of this message
derick Tue, 10 May 2016 18:17:49 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=339160 Log: Fixed example and also some typoes. Changed paths: U phpdoc/en/trunk/reference/mongo/mongocollection/aggregate.xml Modified: phpdoc/en/trunk/reference/mongo/mongocollection/aggregate.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongocollection/aggregate.xml 2016-05-10 10:58:05 UTC (rev 339159) +++ phpdoc/en/trunk/reference/mongo/mongocollection/aggregate.xml 2016-05-10 18:17:49 UTC (rev 339160) @@ -271,16 +271,15 @@ $pipeline = array( array( '$group' => array( - '_id' => array('state' => '$state', 'city' => '$city' ), - 'pop' => array('$sum' => '$pop' ) + '_id' => array('state' => '$state'), + 'totalPop' => array('$sum' => '$pop') ) ), array( - '$group' => array( - '_id' => '$_id.state', - 'avgCityPop' => array('$avg' => '$pop') + '$match' => array( + 'totalPop' => array('$gte' => 10 * 1000 * 1000) ) - ) + ), ); $out = $c->aggregate($pipeline); var_dump($out); @@ -426,7 +425,8 @@ <example xml:id="mongocollection.aggregate.example.zipcode.explain"> <title><methodname>MongoCollection::aggregate</methodname> with command options</title> <para> - To return information on how the pipeline will be processed we use the <literal>explain</literal> comman option + To return information on how the pipeline will be processed we use the + <literal>explain</literal> command option: </para> <programlisting role="php"> <![CDATA[ @@ -434,14 +434,17 @@ $m = new MongoClient; $c = $m->selectDB("test")->selectCollection("zips"); -$pipeline = array(array( +$pipeline = array( + array( '$group' => array( '_id' => '$state', 'totalPop' => array('$sum' => '$pop'), ), ), array( - '$match' => array('totalPop' => array('$gte' => 10*1000*1000)), + '$match' => array( + 'totalPop' => array('$gte' => 10 * 1000 * 1000) + ) ), array( '$sort' => array("totalPop" => -1),

« previous php.doc.cvs (#14124) next »