ModelBundle/Repository/RedirectionRepository.php
public function countByPattern($pattern, $redirectionId)
    {
        $qa = $this->createAggregationQuery();
        $qa->match(array(
            'routePattern' => $pattern,
            '_id' => array('$ne' => new \MongoId($redirectionId))
        ));

        return $this->countDocumentAggregateQuery($qa);
    }
public function countByPattern($pattern, $redirectionId)
    {
        $qa = $this->createAggregationQuery();
        $qa->match(array(
            'routePattern' => $pattern,
            '_id' => array('$ne' => new \MongoId($redirectionId))
        ));

        return $this->countDocumentAggregateQuery($qa);
    }
@param string $pattern
@param string $redirectionId

@return int