mongodb - php - 聚合中的匹配和组错误

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

I've replaced the aggregate function with aggregateCursor and it works. So it appears that the problem is resolved.