/**
  * @param string $name The name of this aggregation
  * @param string $path Optional path to the nested object for this aggregation. Defaults to the root of the main document.
  */
 public function __construct($name, $path = null)
 {
     parent::__construct($name);
     if ($path !== null) {
         $this->setPath($path);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param string      $name          the name if this aggregation
  * @param string|null $initScript    Executed prior to any collection of documents
  * @param string|null $mapScript     Executed once per document collected
  * @param string|null $combineScript Executed once on each shard after document collection is complete
  * @param string|null $reduceScript  Executed once on the coordinating node after all shards have returned their results
  */
 public function __construct($name, $initScript = null, $mapScript = null, $combineScript = null, $reduceScript = null)
 {
     parent::__construct($name);
     if ($initScript) {
         $this->setInitScript($initScript);
     }
     if ($mapScript) {
         $this->setMapScript($mapScript);
     }
     if ($combineScript) {
         $this->setCombineScript($combineScript);
     }
     if ($reduceScript) {
         $this->setReduceScript($reduceScript);
     }
 }
Ejemplo n.º 3
0
 /**
  * @param string $name the name of this aggregation
  * @param string $field the field on which to perform this aggregation
  */
 public function __construct($name, $field)
 {
     parent::__construct($name);
     $this->setField($field);
 }
Ejemplo n.º 4
0
 /**
  * @param string $name the name of this aggregation
  * @param string $path the nested path for this aggregation
  */
 public function __construct($name, $path)
 {
     parent::__construct($name);
     $this->setPath($path);
 }
Ejemplo n.º 5
0
 public function __construct($propertyName)
 {
     parent::__construct('SUM', $propertyName);
 }