Performs an operation similar to SQL's GROUP BY command
public group ( mixed $keys, array $initial, MongoCode | string $reduce, array $condition = [] ) : array | ||
$keys | mixed | Fields to group by. If an array or non-code object is passed, it will be the key used to group results. |
$initial | array | Initial value of the aggregation counter object. |
$reduce | MongoCode | string | A function that aggregates (reduces) the objects iterated. |
$condition | array | An condition that must be true for a row to be considered. |
Результат | array |