Sokil\Mongo\Pipeline::addStage PHP Method

addStage() private method

private addStage ( string $operator, mixed $stage )
$operator string aggregate operator like $match, $group ...
$stage mixed stage data
    private function addStage($operator, $stage)
    {
        $lastIndex = count($this->stages) - 1;
        if ($operator == '$match' && isset($this->stages[$lastIndex][$operator])) {
            $this->stages[$lastIndex][$operator] = array_merge($this->stages[$lastIndex][$operator], $stage);
        } else {
            $this->stages[] = array($operator => $stage);
        }
    }