This repository has been archived by the owner on Nov 11, 2020. It is now read-only.
/
Operator.php
1205 lines (1076 loc) · 34.5 KB
/
Operator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\MongoDB\Aggregation\Stage;
use Doctrine\MongoDB\Aggregation\Builder;
use Doctrine\MongoDB\Aggregation\Expr;
use Doctrine\MongoDB\Aggregation\Stage;
/**
* Fluent interface for adding operators to aggregation stages.
*
* @author alcaeus <alcaeus@alcaeus.org>
* @since 1.2
*/
abstract class Operator extends Stage
{
/**
* @var Expr
*/
protected $expr;
/**
* {@inheritdoc}
*/
public function __construct(Builder $builder)
{
parent::__construct($builder);
$this->expr = $builder->expr();
}
/**
* Returns the absolute value of a number.
*
* The <number> argument can be any valid expression as long as it resolves
* to a number.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/abs/
* @see Expr::abs
* @param mixed|Expr $number
* @return $this
*
* @since 1.3
*/
public function abs($number)
{
$this->expr->abs($number);
return $this;
}
/**
* Adds numbers together or adds numbers and a date. If one of the arguments
* is a date, $add treats the other arguments as milliseconds to add to the
* date.
*
* The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/add/
* @see Expr::add
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @param mixed|Expr $expression3,... Additional expressions
* @return $this
*/
public function add($expression1, $expression2 /* , $expression3, ... */)
{
$this->expr->add(...func_get_args());
return $this;
}
/**
* Add one or more $and clauses to the current expression.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/and/
* @see Expr::addAnd
* @param array|Expr $expression
* @return $this
*/
public function addAnd($expression /* , $expression2, ... */)
{
$this->expr->addAnd(...func_get_args());
return $this;
}
/**
* Add one or more $or clauses to the current expression.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/or/
* @see Expr::addOr
* @param array|Expr $expression
* @return $this
*/
public function addOr($expression /* , $expression2, ... */)
{
$this->expr->addOr(...func_get_args());
return $this;
}
/**
* Evaluates an array as a set and returns true if no element in the array
* is false. Otherwise, returns false. An empty array returns true.
*
* The expression must resolve to an array.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/allElementsTrue/
* @see Expr::allElementsTrue
* @param mixed|Expr $expression
* @return $this
*/
public function allElementsTrue($expression)
{
$this->expr->allElementsTrue($expression);
return $this;
}
/**
* Evaluates an array as a set and returns true if any of the elements are
* true and false otherwise. An empty array returns false.
*
* The expression must resolve to an array.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/anyElementTrue/
* @see Expr::anyElementTrue
* @param array|Expr $expression
* @return $this
*/
public function anyElementTrue($expression)
{
$this->expr->anyElementTrue($expression);
return $this;
}
/**
* Returns the element at the specified array index.
*
* The <array> expression can be any valid expression as long as it resolves
* to an array.
* The <idx> expression can be any valid expression as long as it resolves
* to an integer.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/arrayElemAt/
* @see Expr::arrayElemAt
* @param mixed|Expr $array
* @param mixed|Expr $index
* @return $this
*
* @since 1.3
*/
public function arrayElemAt($array, $index)
{
$this->expr->arrayElemAt($array, $index);
return $this;
}
/**
* Returns the smallest integer greater than or equal to the specified number.
*
* The <number> expression can be any valid expression as long as it
* resolves to a number.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/ceil/
* @see Expr::ceil
* @param mixed|Expr $number
* @return $this
*
* @since 1.3
*/
public function ceil($number)
{
$this->expr->ceil($number);
return $this;
}
/**
* Compares two values and returns:
* -1 if the first value is less than the second.
* 1 if the first value is greater than the second.
* 0 if the two values are equivalent.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/cmp/
* @see Expr::cmp
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function cmp($expression1, $expression2)
{
$this->expr->cmp($expression1, $expression2);
return $this;
}
/**
* Concatenates strings and returns the concatenated string.
*
* The arguments can be any valid expression as long as they resolve to
* strings. If the argument resolves to a value of null or refers to a field
* that is missing, $concat returns null.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/concat/
* @see Expr::concat
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @param mixed|Expr $expression3,... Additional expressions
* @return $this
*/
public function concat($expression1, $expression2 /* , $expression3, ... */)
{
$this->expr->concat(...func_get_args());
return $this;
}
/**
* Concatenates arrays to return the concatenated array.
*
* The <array> expressions can be any valid expression as long as they
* resolve to an array.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/concatArrays/
* @see Expr::concatArrays
* @param mixed|Expr $array1
* @param mixed|Expr $array2
* @param mixed|Expr $array3, ... Additional expressions
* @return $this
*
* @since 1.3
*/
public function concatArrays($array1, $array2 /* , $array3, ... */)
{
$this->expr->concatArrays(...func_get_args());
return $this;
}
/**
* Evaluates a boolean expression to return one of the two specified return
* expressions.
*
* The arguments can be any valid expression.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/cond/
* @see Expr::cond
* @param mixed|Expr $if
* @param mixed|Expr $then
* @param mixed|Expr $else
* @return $this
*/
public function cond($if, $then, $else)
{
$this->expr->cond($if, $then, $else);
return $this;
}
/**
* Converts a date object to a string according to a user-specified format.
*
* The format string can be any string literal, containing 0 or more format
* specifiers.
* The date argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/dateToString/
* @see Expr::dateToString
* @param string $format
* @param mixed|Expr $expression
* @return $this
*/
public function dateToString($format, $expression)
{
$this->expr->dateToString($format, $expression);
return $this;
}
/**
* Returns the day of the month for a date as a number between 1 and 31.
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/dayOfMonth/
* @see Expr::dayOfMonth
* @param mixed|Expr $expression
* @return $this
*/
public function dayOfMonth($expression)
{
$this->expr->dayOfMonth($expression);
return $this;
}
/**
* Returns the day of the week for a date as a number between 1 (Sunday) and
* 7 (Saturday).
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/dayOfWeek/
* @see Expr::dayOfWeek
* @param mixed|Expr $expression
* @return $this
*/
public function dayOfWeek($expression)
{
$this->expr->dayOfWeek($expression);
return $this;
}
/**
* Returns the day of the year for a date as a number between 1 and 366.
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/dayOfYear/
* @see Expr::dayOfYear
* @param mixed|Expr $expression
* @return $this
*/
public function dayOfYear($expression)
{
$this->expr->dayOfYear($expression);
return $this;
}
/**
* Divides one number by another and returns the result. The first argument
* is divided by the second argument.
*
* The arguments can be any valid expression as long as the resolve to numbers.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/divide/
* @see Expr::divide
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function divide($expression1, $expression2)
{
$this->expr->divide($expression1, $expression2);
return $this;
}
/**
* Compares two values and returns whether they are equivalent.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/eq/
* @see Expr::eq
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function eq($expression1, $expression2)
{
$this->expr->eq($expression1, $expression2);
return $this;
}
/**
* Raises Euler’s number to the specified exponent and returns the result.
*
* The <exponent> expression can be any valid expression as long as it
* resolves to a number.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/exp/
* @see Expr::exp
* @param mixed|Expr $exponent
* @return $this
*
* @since 1.3
*/
public function exp($exponent)
{
$this->expr->exp($exponent);
return $this;
}
/**
* Used to use an expression as field value. Can be any expression
*
* @see http://docs.mongodb.org/manual/meta/aggregation-quick-reference/#aggregation-expressions
* @see Expr::expression
* @param mixed|Expr $value
* @return $this
*/
public function expression($value)
{
$this->expr->expression($value);
return $this;
}
/**
* Set the current field for building the expression.
*
* @see Expr::field
* @param string $fieldName
* @return $this
*/
public function field($fieldName)
{
$this->expr->field($fieldName);
return $this;
}
/**
* Selects a subset of the array to return based on the specified condition.
*
* Returns an array with only those elements that match the condition. The
* returned elements are in the original order.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/filter/
* @see Expr::filter
* @param mixed|Expr $input
* @param mixed|Expr $as
* @param mixed|Expr $cond
* @return $this
*
* @since 1.3
*/
public function filter($input, $as, $cond)
{
$this->expr->filter($input, $as, $cond);
return $this;
}
/**
* Returns the largest integer less than or equal to the specified number.
*
* The <number> expression can be any valid expression as long as it
* resolves to a number.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/floor/
* @see Expr::floor
* @param mixed|Expr $number
* @return $this
*
* @since 1.3
*/
public function floor($number)
{
$this->expr->floor($number);
return $this;
}
/**
* Compares two values and returns:
* true when the first value is greater than the second value.
* false when the first value is less than or equivalent to the second value.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/gt/
* @see Expr::gt
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function gt($expression1, $expression2)
{
$this->expr->gt($expression1, $expression2);
return $this;
}
/**
* Compares two values and returns:
* true when the first value is greater than or equivalent to the second value.
* false when the first value is less than the second value.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/gte/
* @see Expr::gte
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function gte($expression1, $expression2)
{
$this->expr->gte($expression1, $expression2);
return $this;
}
/**
* Returns the hour portion of a date as a number between 0 and 23.
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/hour/
* @see Expr::hour
* @param mixed|Expr $expression
* @return $this
*/
public function hour($expression)
{
$this->expr->hour($expression);
return $this;
}
/**
* Evaluates an expression and returns the value of the expression if the
* expression evaluates to a non-null value. If the expression evaluates to
* a null value, including instances of undefined values or missing fields,
* returns the value of the replacement expression.
*
* The arguments can be any valid expression.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/ifNull/
* @see Expr::ifNull
* @param mixed|Expr $expression
* @param mixed|Expr $replacementExpression
* @return $this
*/
public function ifNull($expression, $replacementExpression)
{
$this->expr->ifNull($expression, $replacementExpression);
return $this;
}
/**
* Determines if the operand is an array. Returns a boolean.
*
* The <expression> can be any valid expression.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/isArray/
* @see Expr::isArray
* @param mixed|Expr $expression
* @return $this
*
* @since 1.3
*/
public function isArray($expression)
{
$this->expr->isArray($expression);
return $this;
}
/**
* Binds variables for use in the specified expression, and returns the
* result of the expression.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/let/
* @see Expr::let
* @param mixed|Expr $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value.
* @param mixed|Expr $in The expression to evaluate.
* @return $this
*/
public function let($vars, $in)
{
$this->expr->let($vars, $in);
return $this;
}
/**
* Returns a value without parsing. Use for values that the aggregation
* pipeline may interpret as an expression.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/literal/
* @see Expr::literal
* @param mixed|Expr $value
* @return $this
*/
public function literal($value)
{
$this->expr->literal($value);
return $this;
}
/**
* Calculates the natural logarithm ln (i.e loge) of a number and returns
* the result as a double.
*
* The <number> expression can be any valid expression as long as it
* resolves to a non-negative number.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/log/
* @see Expr::ln
* @param mixed|Expr $number
* @return $this
*
* @since 1.3
*/
public function ln($number)
{
$this->expr->ln($number);
return $this;
}
/**
* Calculates the log of a number in the specified base and returns the
* result as a double.
*
* The <number> expression can be any valid expression as long as it
* resolves to a non-negative number.
* The <base> expression can be any valid expression as long as it resolves
* to a positive number greater than 1.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/log/
* @see Expr::log
* @param mixed|Expr $number
* @param mixed|Expr $base
* @return $this
*
* @since 1.3
*/
public function log($number, $base)
{
$this->expr->log($number, $base);
return $this;
}
/**
* Calculates the log base 10 of a number and returns the result as a double.
*
* The <number> expression can be any valid expression as long as it
* resolves to a non-negative number.
* The <base> expression can be any valid expression as long as it resolves
* to a positive number greater than 1.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/log/
* @see Expr::log10
* @param mixed|Expr $number
* @return $this
*
* @since 1.3
*/
public function log10($number)
{
$this->expr->log10($number);
return $this;
}
/**
* Compares two values and returns:
* true when the first value is less than the second value.
* false when the first value is greater than or equivalent to the second value.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/lt/
* @see Expr::lt
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function lt($expression1, $expression2)
{
$this->expr->lt($expression1, $expression2);
return $this;
}
/**
* Compares two values and returns:
* true when the first value is less than or equivalent to the second value.
* false when the first value is greater than the second value.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/lte/
* @see Expr::lte
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function lte($expression1, $expression2)
{
$this->expr->lte($expression1, $expression2);
return $this;
}
/**
* Applies an expression to each item in an array and returns an array with
* the applied results.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/map/
* @see Expr::map
* @param mixed|Expr $input An expression that resolves to an array.
* @param string $as The variable name for the items in the input array. The in expression accesses each item in the input array by this variable.
* @param mixed|Expr $in The expression to apply to each item in the input array. The expression accesses the item by its variable name.
* @return $this
*/
public function map($input, $as, $in)
{
$this->expr->map($input, $as, $in);
return $this;
}
/**
* Returns the metadata associated with a document in a pipeline operations.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/meta/
* @see Expr::meta
* @param $metaDataKeyword
* @return $this
*/
public function meta($metaDataKeyword)
{
$this->expr->meta($metaDataKeyword);
return $this;
}
/**
* Returns the millisecond portion of a date as an integer between 0 and 999.
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/millisecond/
* @see Expr::millisecond
* @param mixed|Expr $expression
* @return $this
*/
public function millisecond($expression)
{
$this->expr->millisecond($expression);
return $this;
}
/**
* Returns the minute portion of a date as a number between 0 and 59.
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/minute/
* @see Expr::minute
* @param mixed|Expr $expression
* @return $this
*/
public function minute($expression)
{
$this->expr->minute($expression);
return $this;
}
/**
* Divides one number by another and returns the remainder. The first
* argument is divided by the second argument.
*
* The arguments can be any valid expression as long as they resolve to numbers.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/mod/
* @see Expr::mod
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function mod($expression1, $expression2)
{
$this->expr->mod($expression1, $expression2);
return $this;
}
/**
* Returns the month of a date as a number between 1 and 12.
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/month/
* @see Expr::month
* @param mixed|Expr $expression
* @return $this
*/
public function month($expression)
{
$this->expr->month($expression);
return $this;
}
/**
* Multiplies numbers together and returns the result.
*
* The arguments can be any valid expression as long as they resolve to numbers.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/multiply/
* @see Expr::multiply
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @param mixed|Expr $expression3,... Additional expressions
* @return $this
*/
public function multiply($expression1, $expression2 /* , $expression3, ... */)
{
$this->expr->multiply(...func_get_args());
return $this;
}
/**
* Compares two values and returns:
* true when the values are not equivalent.
* false when the values are equivalent.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/ne/
* @see Expr::ne
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function ne($expression1, $expression2)
{
$this->expr->ne($expression1, $expression2);
return $this;
}
/**
* Evaluates a boolean and returns the opposite boolean value.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/not/
* @see Expr::not
* @param mixed|Expr $expression
* @return $this
*/
public function not($expression)
{
$this->expr->not($expression);
return $this;
}
/**
* Raises a number to the specified exponent and returns the result.
*
* The <number> expression can be any valid expression as long as it
* resolves to a non-negative number.
* The <exponent> expression can be any valid expression as long as it
* resolves to a number.
*
* @see https://docs.mongodb.org/manual/reference/operator/aggregation/pow/
* @see Expr::pow
* @param mixed|Expr $number
* @param mixed|Expr $exponent
* @return $this
*
* @since 1.3
*/
public function pow($number, $exponent)
{
$this->expr->pow($number, $exponent);
return $this;
}
/**
* Returns the second portion of a date as a number between 0 and 59, but
* can be 60 to account for leap seconds.
*
* The argument can be any expression as long as it resolves to a date.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/second/
* @see Expr::second
* @param mixed|Expr $expression
* @return $this
*/
public function second($expression)
{
$this->expr->second($expression);
return $this;
}
/**
* Takes two sets and returns an array containing the elements that only
* exist in the first set.
*
* The arguments can be any valid expression as long as they each resolve to an array.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/setDifference/
* @see Expr::setDifference
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function setDifference($expression1, $expression2)
{
$this->expr->setDifference($expression1, $expression2);
return $this;
}
/**
* Compares two or more arrays and returns true if they have the same
* distinct elements and false otherwise.
*
* The arguments can be any valid expression as long as they each resolve to an array.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/setEquals/
* @see Expr::setEquals
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @param mixed|Expr $expression3,... Additional sets
* @return $this
*/
public function setEquals($expression1, $expression2 /* , $expression3, ... */)
{
$this->expr->setEquals(...func_get_args());
return $this;
}
/**
* Takes two or more arrays and returns an array that contains the elements
* that appear in every input array.
*
* The arguments can be any valid expression as long as they each resolve to an array.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/setIntersection/
* @see Expr::setIntersection
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @param mixed|Expr $expression3,... Additional sets
* @return $this
*/
public function setIntersection($expression1, $expression2 /* , $expression3, ... */)
{
$this->expr->setIntersection(...func_get_args());
return $this;
}
/**
* Takes two arrays and returns true when the first array is a subset of the
* second, including when the first array equals the second array, and false
* otherwise.
*
* The arguments can be any valid expression as long as they each resolve to an array.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/setIsSubset/
* @see Expr::setIsSubset
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @return $this
*/
public function setIsSubset($expression1, $expression2)
{
$this->expr->setIsSubset($expression1, $expression2);
return $this;
}
/**
* Takes two or more arrays and returns an array containing the elements
* that appear in any input array.
*
* The arguments can be any valid expression as long as they each resolve to an array.
*
* @see http://docs.mongodb.org/manual/reference/operator/aggregation/setUnion/
* @see Expr::setUnion
* @param mixed|Expr $expression1
* @param mixed|Expr $expression2
* @param mixed|Expr $expression3,... Additional sets
* @return $this
*/
public function setUnion($expression1, $expression2 /* , $expression3, ... */)
{
$this->expr->setUnion(...func_get_args());
return $this;