부터: 1.2
저자: alcaeus (alcaeus@alcaeus.org)
예제 #1
0
 /**
  * Returns the assembled aggregation pipeline
  *
  * 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.
  *
  * @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;
 }
예제 #2
0
파일: Stage.php 프로젝트: alcaeus/mongodb
 /**
  * Deconstructs an array field from the input documents to output a document
  * for each element. Each output document is the input document with the
  * value of the array field replaced by the element.
  *
  * @see http://docs.mongodb.org/manual/reference/operator/aggregation/unwind/
  *
  * @param string $fieldName The field to unwind. It is automatically prefixed with the $ sign
  * @return Stage\Unwind
  */
 public function unwind($fieldName)
 {
     return $this->builder->unwind($fieldName);
 }