ModelBundle/Repository/NodeRepository.php
public function findWithUseReferences($siteId)
    {
        $where = "function() { return this.useReferences && Object.keys(this.useReferences).length > 0; }";
        $qb = $this->createQueryBuilder();
        $qb->field('siteId')->equals($siteId)
           ->field('useReferences')->where($where);

        return $qb->getQuery()->execute();
    }
public function findWithUseReferences($siteId)
    {
        $where = "function() { return this.useReferences && Object.keys(this.useReferences).length > 0; }";
        $qb = $this->createQueryBuilder();
        $qb->field('siteId')->equals($siteId)
           ->field('useReferences')->where($where);

        return $qb->getQuery()->execute();
    }
@param $siteId

@return Collection

@throws \Doctrine\ODM\MongoDB\MongoDBException