yii\mongodb\QueryBuilder::aggregate PHP Метод

aggregate() публичный Метод

Generates 'aggregate' command.
public aggregate ( string $collectionName, array $pipelines, array $options = [] ) : array
$collectionName string collection name
$pipelines array list of pipeline operators.
$options array optional parameters.
Результат array command document.
    public function aggregate($collectionName, $pipelines, $options = [])
    {
        foreach ($pipelines as $key => $pipeline) {
            if (isset($pipeline['$match'])) {
                $pipelines[$key]['$match'] = $this->buildCondition($pipeline['$match']);
            }
        }
        $document = array_merge(['aggregate' => $collectionName, 'pipeline' => $pipelines, 'allowDiskUse' => false], $options);
        return $document;
    }