$keys = array("category" => 1); $initial = array("items" => array()); $reduce = "function (obj, prev) { prev.items.push(obj.name); }"; $g = $collection->group($keys, $initial, $reduce); print_r($g); //结果如下。 Array ( [retval] => Array ( [0] => Array ( [category] => fruit [items] => Array ( [0] => apple [1] => peach [2] => banana ) ) [1] => Array ( [category] => veggie [items] => Array ( [0] => corn [1] => broccoli ) ) ) [count] => 5 [keys] => 2 [ok] => 1 )