**I have a database in MongoDB
if I use CMD using the aggrate script the results will appear**
result like this using cmd
db.getCollection('teacher').aggregate( [ {$group : {_id: '$name', count : {$sum : 1}}} ])
{ "_id" : "budi", "count" : 3 }
{ "_id" : "sinta", "count" : 3 }
, если импементация в PHP не может привести к тому же результату с использованием CMD
это код от PHP
**
<code>$cmd = new \MongoDB\Driver\Command([
'aggregate' => 'collection',
'pipeline' => [['$group' => ['_id' => '$name', 'count' => ['$sum' => 1]]]],
'cursor' => new stdClass,
]);
$cursor = $manager->executeCommand('teacher', $cmd);
$records = iterator_to_array($cursor,true);
var_dump($records);
echo '<pre>';
echo print_r($records);
echo '
';
**
результат abvoe
**array(0) { }
Array
(
)**
please help me to generate data like in CMD using PHP