@@ 14-50 (lines=37) @@ | ||
11 | /** |
|
12 | * Fluent interface for adding an output specification to a bucket stage. |
|
13 | */ |
|
14 | class BucketAutoOutput extends AbstractOutput |
|
15 | { |
|
16 | public function __construct(Builder $builder, Stage\BucketAuto $bucket) |
|
17 | { |
|
18 | parent::__construct($builder, $bucket); |
|
19 | } |
|
20 | ||
21 | /** |
|
22 | * An expression to group documents by. To specify a field path, prefix the |
|
23 | * field name with a dollar sign $ and enclose it in quotes. |
|
24 | */ |
|
25 | public function groupBy($expression) : Stage\BucketAuto |
|
26 | { |
|
27 | assert($this->bucket instanceof Stage\BucketAuto); |
|
28 | return $this->bucket->groupBy($expression); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. |
|
33 | */ |
|
34 | public function buckets(int $buckets) : Stage\BucketAuto |
|
35 | { |
|
36 | assert($this->bucket instanceof Stage\BucketAuto); |
|
37 | return $this->bucket->buckets($buckets); |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * A string that specifies the preferred number series to use to ensure that |
|
42 | * the calculated boundary edges end on preferred round numbers or their |
|
43 | * powers of 10. |
|
44 | */ |
|
45 | public function granularity(string $granularity) : Stage\BucketAuto |
|
46 | { |
|
47 | assert($this->bucket instanceof Stage\BucketAuto); |
|
48 | return $this->bucket->granularity($granularity); |
|
49 | } |
|
50 | } |
|
51 |
@@ 15-69 (lines=55) @@ | ||
12 | /** |
|
13 | * Fluent interface for adding an output specification to a bucket stage. |
|
14 | */ |
|
15 | class BucketOutput extends AbstractOutput |
|
16 | { |
|
17 | public function __construct(Builder $builder, Stage\Bucket $bucket) |
|
18 | { |
|
19 | parent::__construct($builder, $bucket); |
|
20 | } |
|
21 | ||
22 | /** |
|
23 | * An expression to group documents by. To specify a field path, prefix the |
|
24 | * field name with a dollar sign $ and enclose it in quotes. |
|
25 | * |
|
26 | * @param mixed|Expr $expression |
|
27 | * |
|
28 | * @return Stage\Bucket |
|
29 | */ |
|
30 | public function groupBy($expression) |
|
31 | { |
|
32 | assert($this->bucket instanceof Stage\Bucket); |
|
33 | return $this->bucket->groupBy($expression); |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * An array of values based on the groupBy expression that specify the |
|
38 | * boundaries for each bucket. |
|
39 | * |
|
40 | * Each adjacent pair of values acts as the inclusive lower boundary and the |
|
41 | * exclusive upper boundary for the bucket. You must specify at least two |
|
42 | * boundaries. The specified values must be in ascending order and all of |
|
43 | * the same type. The exception is if the values are of mixed numeric types. |
|
44 | * |
|
45 | * @param array ...$boundaries |
|
46 | * |
|
47 | * @return Stage\Bucket |
|
48 | */ |
|
49 | public function boundaries(...$boundaries) |
|
50 | { |
|
51 | assert($this->bucket instanceof Stage\Bucket); |
|
52 | return $this->bucket->boundaries(...$boundaries); |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * A literal that specifies the _id of an additional bucket that contains |
|
57 | * all documents whose groupBy expression result does not fall into a bucket |
|
58 | * specified by boundaries. |
|
59 | * |
|
60 | * @param mixed $default |
|
61 | * |
|
62 | * @return Stage\Bucket |
|
63 | */ |
|
64 | public function defaultBucket($default) |
|
65 | { |
|
66 | assert($this->bucket instanceof Stage\Bucket); |
|
67 | return $this->bucket->defaultBucket($default); |
|
68 | } |
|
69 | } |
|
70 |