Since the $options argument is no longer a scalar (deprecated since the 1.2.11 version of the Mongo's PHP driver), you now must compose your $options as an associative array, otherwise you'll rise a "Implicitly passing condition as $options will be removed in the future" alert.
Example:
<?php
$m = new Mongo();
$db = $m->selectDB('test');
$collection = new MongoCollection($db, 'FooBar');
// grouping results by categories, where foo is 'bar'
$keys = array('categorie'=>true, 'foo'=>true); // the fields list we want to return
$initial = array('count' => 0); // gets a subtotal for each categorie
$reduce = "function(obj,prev) { prev.count += 1; }"; // yes, this is js code
$conditions =
array('condition'=>
array('foo'=> 'bar'));
$grouped = $myColl::group($keys, $initial, $reduce, $conditions
);
$result = $grouped['retval'];
注:
举个例子
在1.2.11版本及以前
$condition = array("a" => array( '$gt' => 1)
);
之后为更新为
$condition = array('condition' => array("a" => array( '$gt' => 1))
);
?>