我有这个聚合:
$out = $db->stats->aggregate (
array('$match' => $where),
,array( '$group' =>
array( "_id" => '$traffic.source',
'count'=> array('$sum' => 1)
)
)
,array( '$project' =>
array( "_id" => 0,
'type' => '$_id',
'count' => '$count'
)
)
);
返回一个数组:
[{type:sourceA, count:2},{type:sourceB, count:6}...]
是否有可能让它返回:
[sourceA:2, sourceB:6,....]
后没有循环数组?