<?php
$manager = new MongoDB\Driver\Manager('mongodb://localhost:27017');
$command = new MongoDB\Driver\Command([
'aggregate' => '表名',
'pipeline' => [
['$match' => ['isDeleted' => false]],
['$group' => ['_id' => '$phone', 'sum' => ['$sum' => 1]]],
],
'cursor' => new stdClass,
]);
$cursor = $manager->executeCommand('数据库名字', $command);
foreach ($cursor as $key => $document) {
var_dump($document);
}