1 | <?php |
||
16 | abstract class AbstractOutput extends Stage |
||
17 | { |
||
18 | /** @var Stage\AbstractBucket */ |
||
19 | protected $bucket; |
||
20 | |||
21 | /** @var Expr */ |
||
22 | private $expr; |
||
23 | |||
24 | 6 | public function __construct(Builder $builder, Stage\AbstractBucket $bucket) |
|
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 6 | public function getExpression() : array |
|
39 | |||
40 | /** |
||
41 | * Returns an array of all unique values that results from applying an |
||
42 | * expression to each document in a group of documents that share the same |
||
43 | * group by key. Order of the elements in the output array is unspecified. |
||
44 | * |
||
45 | * AddToSet is an accumulator operation only available in the group stage. |
||
46 | * |
||
47 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/addToSet/ |
||
48 | * @see Expr::addToSet |
||
49 | * |
||
50 | * @param mixed|Expr $expression |
||
51 | * |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function addToSet($expression) |
||
60 | |||
61 | /** |
||
62 | * Returns the average value of the numeric values that result from applying |
||
63 | * a specified expression to each document in a group of documents that |
||
64 | * share the same group by key. Ignores nun-numeric values. |
||
65 | * |
||
66 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/avg/ |
||
67 | * @see Expr::avg |
||
68 | * |
||
69 | * @param mixed|Expr $expression |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | 6 | public function avg($expression) |
|
79 | |||
80 | /** |
||
81 | * Used to use an expression as field value. Can be any expression. |
||
82 | * |
||
83 | * @see http://docs.mongodb.org/manual/meta/aggregation-quick-reference/#aggregation-expressions |
||
84 | * @see Expr::expression |
||
85 | * |
||
86 | * @param mixed|Expr $value |
||
87 | * |
||
88 | * @return $this |
||
89 | */ |
||
90 | public function expression($value) |
||
96 | |||
97 | /** |
||
98 | * Set the current field for building the expression. |
||
99 | * |
||
100 | * @see Expr::field |
||
101 | * |
||
102 | * @param string $fieldName |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | 6 | public function field($fieldName) |
|
112 | |||
113 | /** |
||
114 | * Returns the value that results from applying an expression to the first |
||
115 | * document in a group of documents that share the same group by key. Only |
||
116 | * meaningful when documents are in a defined order. |
||
117 | * |
||
118 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/first/ |
||
119 | * @see Expr::first |
||
120 | * |
||
121 | * @param mixed|Expr $expression |
||
122 | * |
||
123 | * @return $this |
||
124 | */ |
||
125 | public function first($expression) |
||
131 | |||
132 | /** |
||
133 | * Returns the value that results from applying an expression to the last |
||
134 | * document in a group of documents that share the same group by a field. |
||
135 | * Only meaningful when documents are in a defined order. |
||
136 | * |
||
137 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/last/ |
||
138 | * @see Expr::last |
||
139 | * |
||
140 | * @param mixed|Expr $expression |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | public function last($expression) |
||
150 | |||
151 | /** |
||
152 | * Returns the highest value that results from applying an expression to |
||
153 | * each document in a group of documents that share the same group by key. |
||
154 | * |
||
155 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/max/ |
||
156 | * @see Expr::max |
||
157 | * |
||
158 | * @param mixed|Expr $expression |
||
159 | * |
||
160 | * @return $this |
||
161 | */ |
||
162 | public function max($expression) |
||
168 | |||
169 | /** |
||
170 | * Returns the lowest value that results from applying an expression to each |
||
171 | * document in a group of documents that share the same group by key. |
||
172 | * |
||
173 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/min/ |
||
174 | * @see Expr::min |
||
175 | * |
||
176 | * @param mixed|Expr $expression |
||
177 | * |
||
178 | * @return $this |
||
179 | */ |
||
180 | public function min($expression) |
||
186 | |||
187 | /** |
||
188 | * Returns an array of all values that result from applying an expression to |
||
189 | * each document in a group of documents that share the same group by key. |
||
190 | * |
||
191 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/push/ |
||
192 | * @see Expr::push |
||
193 | * |
||
194 | * @param mixed|Expr $expression |
||
195 | * |
||
196 | * @return $this |
||
197 | */ |
||
198 | public function push($expression) |
||
204 | |||
205 | /** |
||
206 | * Calculates the population standard deviation of the input values. |
||
207 | * |
||
208 | * The argument can be any expression as long as it resolves to an array. |
||
209 | * |
||
210 | * @see https://docs.mongodb.org/manual/reference/operator/aggregation/stdDevPop/ |
||
211 | * @see Expr::stdDevPop |
||
212 | * |
||
213 | * @param mixed|Expr $expression |
||
214 | * |
||
215 | * @return $this |
||
216 | */ |
||
217 | public function stdDevPop($expression) |
||
223 | |||
224 | /** |
||
225 | * Calculates the sample standard deviation of the input values. |
||
226 | * |
||
227 | * The argument can be any expression as long as it resolves to an array. |
||
228 | * |
||
229 | * @see https://docs.mongodb.org/manual/reference/operator/aggregation/stdDevSamp/ |
||
230 | * @see Expr::stdDevSamp |
||
231 | * |
||
232 | * @param mixed|Expr $expression |
||
233 | * |
||
234 | * @return $this |
||
235 | */ |
||
236 | public function stdDevSamp($expression) |
||
242 | |||
243 | /** |
||
244 | * Calculates and returns the sum of all the numeric values that result from |
||
245 | * applying a specified expression to each document in a group of documents |
||
246 | * that share the same group by key. Ignores nun-numeric values. |
||
247 | * |
||
248 | * @see http://docs.mongodb.org/manual/reference/operator/aggregation/sum/ |
||
249 | * @see Expr::sum |
||
250 | * |
||
251 | * @param mixed|Expr $expression |
||
252 | * |
||
253 | * @return $this |
||
254 | */ |
||
255 | public function sum($expression) |
||
261 | } |
||
262 |