I'm trying to group by "group_name" and select fields "group_name" and "group_id" with php driver using aggregation framework:
Array
(
[$project] => Array
(
[group_name] => 1
[group_id] => 1
)
[$group] => Array
(
[_id] => $group_name
[total_sum] => Array
(
[$sum] => 1
)
)
)
I'm getting this: [errmsg] => exception: A pipeline stage specification object must contain exactly one field.
However, when I'm using only $project
or $group
operator it works just fine.