Doctrine\ODM\MongoDB\Aggregation\Builder::getPipeline PHP Method

getPipeline() public method

For pipelines where the first stage is a $geoNear stage, it will apply the document filters and discriminator queries to the query portion of the geoNear operation. For all other pipelines, it prepends a $match stage containing the required query.
public getPipeline ( ) : array
return array
    public function getPipeline()
    {
        $pipeline = parent::getPipeline();
        if ($this->getStage(0) instanceof GeoNear) {
            $pipeline[0]['$geoNear']['query'] = $this->applyFilters($pipeline[0]['$geoNear']['query']);
        } else {
            $matchStage = $this->applyFilters([]);
            if ($matchStage !== []) {
                array_unshift($pipeline, ['$match' => $matchStage]);
            }
        }
        return $pipeline;
    }