My mongodb aggregate function works fine, but my PHP doesn't.
This is my PHP code and mongodb script respectively :
php:
$group_by_app = [['$match' => ['Name' => 'Tom']],['$group' => ['_id' => '$Hobbit', 'count' => ['$sum' => 1]]]];
$cursor = $collection -> aggregate($group_by_app);
mongodb script :
db.myCollocations.aggregate({$match:{Name:'Tom'}},{$group:{_id:"$Hobbit",count:{"$sum":1}}})
Thanks in advance