@mongodb-js/mql-typescript 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/schema.d.ts CHANGED
@@ -19,7 +19,7 @@ type RecordWithStaticFields<T extends Record<string, any>, TValue> = T & {
19
19
 
20
20
  // TBD: Nested fields
21
21
  type AFieldPath<S, Type> = KeysOfAType<S, Type> & string;
22
- type FieldExpression<T> = { [k: string]: FieldPath<T> };
22
+ type FieldExpression<T> = { [k: string]: Expression<T> };
23
23
 
24
24
  type MultiAnalyzerSpec<T> = {
25
25
  value: KeysOfAType<T, string>;
@@ -82,6 +82,7 @@ export namespace Aggregation.Accumulator {
82
82
  /**
83
83
  * Returns an array of unique expression values for each group. Order of the array elements is undefined.
84
84
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
85
+ * New in MongoDB 2.2.
85
86
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/}
86
87
  */
87
88
  $addToSet: Expression<S>;
@@ -95,6 +96,7 @@ export namespace Aggregation.Accumulator {
95
96
  /**
96
97
  * Returns an average of numerical values. Ignores non-numeric values.
97
98
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
99
+ * New in MongoDB 2.2.
98
100
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/}
99
101
  */
100
102
  $avg: ResolvesToNumber<S>;
@@ -107,7 +109,7 @@ export namespace Aggregation.Accumulator {
107
109
  export interface $bottom<S> {
108
110
  /**
109
111
  * Returns the bottom element within a group according to the specified sort order.
110
- * New in MongoDB 5.2: Available in the $group and $setWindowFields stages.
112
+ * New in MongoDB 5.2.
111
113
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/}
112
114
  */
113
115
  $bottom: {
@@ -130,8 +132,8 @@ export namespace Aggregation.Accumulator {
130
132
  export interface $bottomN<S> {
131
133
  /**
132
134
  * Returns an aggregation of the bottom n elements within a group, according to the specified sort order. If the group contains fewer than n elements, $bottomN returns all elements in the group.
133
- * New in MongoDB 5.2.
134
135
  * Available in the $group and $setWindowFields stages.
136
+ * New in MongoDB 5.2.
135
137
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/}
136
138
  */
137
139
  $bottomN: {
@@ -152,6 +154,25 @@ export namespace Aggregation.Accumulator {
152
154
  };
153
155
  }
154
156
 
157
+ /**
158
+ * A type describing the `$concatArrays` operator.
159
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/}
160
+ */
161
+ export interface $concatArrays<S> {
162
+ /**
163
+ * Concatenates arrays to return the concatenated array.
164
+ * New in MongoDB 4.4.
165
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/}
166
+ */
167
+ $concatArrays: [
168
+ /**
169
+ * An array of expressions that resolve to an array.
170
+ * If any argument resolves to a value of null or refers to a field that is missing, `$concatArrays` returns `null`.
171
+ */
172
+ ...ResolvesToArray<S>[],
173
+ ];
174
+ }
175
+
155
176
  /**
156
177
  * A type describing the `$count` operator.
157
178
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/count-accumulator/}
@@ -281,6 +302,7 @@ export namespace Aggregation.Accumulator {
281
302
  /**
282
303
  * Returns the result of an expression for the first document in a group or window.
283
304
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
305
+ * New in MongoDB 2.2.
284
306
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/}
285
307
  */
286
308
  $first: Expression<S>;
@@ -295,6 +317,7 @@ export namespace Aggregation.Accumulator {
295
317
  * Returns an aggregation of the first n elements within a group.
296
318
  * The elements returned are meaningful only if in a specified sort order.
297
319
  * If the group contains fewer than n elements, $firstN returns all elements in the group.
320
+ * New in MongoDB 5.2.
298
321
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/}
299
322
  */
300
323
  $firstN: {
@@ -339,6 +362,7 @@ export namespace Aggregation.Accumulator {
339
362
  /**
340
363
  * Returns the result of an expression for the last document in a group or window.
341
364
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
365
+ * New in MongoDB 2.2.
342
366
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/}
343
367
  */
344
368
  $last: Expression<S>;
@@ -353,13 +377,14 @@ export namespace Aggregation.Accumulator {
353
377
  * Returns an aggregation of the last n elements within a group.
354
378
  * The elements returned are meaningful only if in a specified sort order.
355
379
  * If the group contains fewer than n elements, $lastN returns all elements in the group.
380
+ * New in MongoDB 5.2.
356
381
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/}
357
382
  */
358
383
  $lastN: {
359
384
  /**
360
385
  * An expression that resolves to the array from which to return n elements.
361
386
  */
362
- input: Expression<S>;
387
+ input: ResolvesToArray<S>;
363
388
 
364
389
  /**
365
390
  * An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns.
@@ -404,6 +429,7 @@ export namespace Aggregation.Accumulator {
404
429
  /**
405
430
  * Returns the maximum value that results from applying an expression to each document.
406
431
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
432
+ * New in MongoDB 2.2.
407
433
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/}
408
434
  */
409
435
  $max: Expression<S>;
@@ -416,6 +442,7 @@ export namespace Aggregation.Accumulator {
416
442
  export interface $maxN<S> {
417
443
  /**
418
444
  * Returns the n largest values in an array. Distinct from the $maxN accumulator.
445
+ * New in MongoDB 5.2.
419
446
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/}
420
447
  */
421
448
  $maxN: {
@@ -438,11 +465,11 @@ export namespace Aggregation.Accumulator {
438
465
  export interface $median<S> {
439
466
  /**
440
467
  * Returns an approximation of the median, the 50th percentile, as a scalar value.
441
- * New in MongoDB 7.0.
442
468
  * This operator is available as an accumulator in these stages:
443
469
  * $group
444
470
  * $setWindowFields
445
471
  * It is also available as an aggregation expression.
472
+ * New in MongoDB 7.0.
446
473
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/}
447
474
  */
448
475
  $median: {
@@ -465,6 +492,7 @@ export namespace Aggregation.Accumulator {
465
492
  export interface $mergeObjects<S> {
466
493
  /**
467
494
  * Combines multiple documents into a single document.
495
+ * New in MongoDB 3.4.
468
496
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/}
469
497
  */
470
498
  $mergeObjects: ResolvesToObject<S>;
@@ -478,11 +506,44 @@ export namespace Aggregation.Accumulator {
478
506
  /**
479
507
  * Returns the minimum value that results from applying an expression to each document.
480
508
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
509
+ * New in MongoDB 2.2.
481
510
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/}
482
511
  */
483
512
  $min: Expression<S>;
484
513
  }
485
514
 
515
+ /**
516
+ * A type describing the `$minMaxScaler` operator.
517
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minMaxScaler/}
518
+ */
519
+ export interface $minMaxScaler<S> {
520
+ /**
521
+ * Normalizes a numeric expression within a window of values. By default, values can range
522
+ * between zero and one. The smallest value becomes zero, the largest value becomes one, and
523
+ * all other values scale proportionally in between. You can also specify a custom minimum
524
+ * and maximum value for the normalized output range.
525
+ * Available only in the $setWindowFields stage.
526
+ * New in MongoDB 8.2.
527
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minMaxScaler/}
528
+ */
529
+ $minMaxScaler: {
530
+ /**
531
+ * Numeric expression containing the value that you want to normalize.
532
+ */
533
+ input: ResolvesToNumber<S>;
534
+
535
+ /**
536
+ * Minimum value that you want in the output. If omitted, defaults to 0.
537
+ */
538
+ min?: Number;
539
+
540
+ /**
541
+ * Maximum value that you want in the output. If omitted, defaults to 1.
542
+ */
543
+ max?: Number;
544
+ };
545
+ }
546
+
486
547
  /**
487
548
  * A type describing the `$minN` operator.
488
549
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/}
@@ -490,6 +551,7 @@ export namespace Aggregation.Accumulator {
490
551
  export interface $minN<S> {
491
552
  /**
492
553
  * Returns the n smallest values in an array. Distinct from the $minN accumulator.
554
+ * New in MongoDB 5.2.
493
555
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/}
494
556
  */
495
557
  $minN: {
@@ -512,11 +574,11 @@ export namespace Aggregation.Accumulator {
512
574
  export interface $percentile<S> {
513
575
  /**
514
576
  * Returns an array of scalar values that correspond to specified percentile values.
515
- * New in MongoDB 7.0.
516
577
  * This operator is available as an accumulator in these stages:
517
578
  * $group
518
579
  * $setWindowFields
519
580
  * It is also available as an aggregation expression.
581
+ * New in MongoDB 7.0.
520
582
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/}
521
583
  */
522
584
  $percentile: {
@@ -546,6 +608,7 @@ export namespace Aggregation.Accumulator {
546
608
  /**
547
609
  * Returns an array of values that result from applying an expression to each document.
548
610
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
611
+ * New in MongoDB 2.2.
549
612
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/push/}
550
613
  */
551
614
  $push: Expression<S>;
@@ -564,6 +627,24 @@ export namespace Aggregation.Accumulator {
564
627
  $rank: Record<string, never>;
565
628
  }
566
629
 
630
+ /**
631
+ * A type describing the `$setUnion` operator.
632
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/}
633
+ */
634
+ export interface $setUnion<S> {
635
+ /**
636
+ * Takes two or more arrays and returns an array containing the elements that appear in any input array.
637
+ * New in MongoDB 4.4.
638
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/}
639
+ */
640
+ $setUnion: [
641
+ /**
642
+ * An array of expressions that resolve to an array.
643
+ */
644
+ ...ResolvesToArray<S>[],
645
+ ];
646
+ }
647
+
567
648
  /**
568
649
  * A type describing the `$shift` operator.
569
650
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/}
@@ -607,6 +688,7 @@ export namespace Aggregation.Accumulator {
607
688
  * Calculates the population standard deviation of the input values. Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population. $stdDevPop ignores non-numeric values.
608
689
  * If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead.
609
690
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
691
+ * New in MongoDB 3.2.
610
692
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/}
611
693
  */
612
694
  $stdDevPop: ResolvesToNumber<S>;
@@ -621,6 +703,7 @@ export namespace Aggregation.Accumulator {
621
703
  * Calculates the sample standard deviation of the input values. Use if the values encompass a sample of a population of data from which to generalize about the population. $stdDevSamp ignores non-numeric values.
622
704
  * If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead.
623
705
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
706
+ * New in MongoDB 3.2.
624
707
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/}
625
708
  */
626
709
  $stdDevSamp: ResolvesToNumber<S>;
@@ -634,6 +717,7 @@ export namespace Aggregation.Accumulator {
634
717
  /**
635
718
  * Returns a sum of numerical values. Ignores non-numeric values.
636
719
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
720
+ * New in MongoDB 2.2.
637
721
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/}
638
722
  */
639
723
  $sum: ResolvesToNumber<S>;
@@ -646,8 +730,8 @@ export namespace Aggregation.Accumulator {
646
730
  export interface $top<S> {
647
731
  /**
648
732
  * Returns the top element within a group according to the specified sort order.
649
- * New in MongoDB 5.2.
650
733
  * Available in the $group and $setWindowFields stages.
734
+ * New in MongoDB 5.2.
651
735
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/top/}
652
736
  */
653
737
  $top: {
@@ -670,8 +754,8 @@ export namespace Aggregation.Accumulator {
670
754
  export interface $topN<S> {
671
755
  /**
672
756
  * Returns an aggregation of the top n fields within a group, according to the specified sort order.
673
- * New in MongoDB 5.2.
674
757
  * Available in the $group and $setWindowFields stages.
758
+ * New in MongoDB 5.2.
675
759
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/}
676
760
  */
677
761
  $topN: {
@@ -700,6 +784,7 @@ export namespace Aggregation.Expression {
700
784
  export interface $abs<S> {
701
785
  /**
702
786
  * Returns the absolute value of a number.
787
+ * New in MongoDB 3.2.
703
788
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/}
704
789
  */
705
790
  $abs: ResolvesToNumber<S>;
@@ -712,6 +797,7 @@ export namespace Aggregation.Expression {
712
797
  export interface $acos<S> {
713
798
  /**
714
799
  * Returns the inverse cosine (arc cosine) of a value in radians.
800
+ * New in MongoDB 4.2.
715
801
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/acos/}
716
802
  */
717
803
  $acos: ResolvesToNumber<S>;
@@ -724,6 +810,7 @@ export namespace Aggregation.Expression {
724
810
  export interface $acosh<S> {
725
811
  /**
726
812
  * Returns the inverse hyperbolic cosine (hyperbolic arc cosine) of a value in radians.
813
+ * New in MongoDB 4.2.
727
814
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/acosh/}
728
815
  */
729
816
  $acosh: ResolvesToNumber<S>;
@@ -736,6 +823,7 @@ export namespace Aggregation.Expression {
736
823
  export interface $add<S> {
737
824
  /**
738
825
  * Adds numbers to return the sum, or adds numbers and a date to return a new date. If adding numbers and a date, treats the numbers as milliseconds. Accepts any number of argument expressions, but at most, one expression can resolve to a date.
826
+ * New in MongoDB 2.6.
739
827
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/}
740
828
  */
741
829
  $add: [
@@ -753,6 +841,7 @@ export namespace Aggregation.Expression {
753
841
  export interface $allElementsTrue<S> {
754
842
  /**
755
843
  * Returns true if no element of a set evaluates to false, otherwise, returns false. Accepts a single argument expression.
844
+ * New in MongoDB 3.0.
756
845
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/allElementsTrue/}
757
846
  */
758
847
  $allElementsTrue: [expression: ResolvesToArray<S>];
@@ -765,6 +854,7 @@ export namespace Aggregation.Expression {
765
854
  export interface $and<S> {
766
855
  /**
767
856
  * Returns true only when all its expressions evaluate to true. Accepts any number of argument expressions.
857
+ * New in MongoDB 2.6.
768
858
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/and/}
769
859
  */
770
860
  $and: [
@@ -785,6 +875,7 @@ export namespace Aggregation.Expression {
785
875
  export interface $anyElementTrue<S> {
786
876
  /**
787
877
  * Returns true if any elements of a set evaluate to true; otherwise, returns false. Accepts a single argument expression.
878
+ * New in MongoDB 3.0.
788
879
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/anyElementTrue/}
789
880
  */
790
881
  $anyElementTrue: [expression: ResolvesToArray<S>];
@@ -797,6 +888,7 @@ export namespace Aggregation.Expression {
797
888
  export interface $arrayElemAt<S> {
798
889
  /**
799
890
  * Returns the element at the specified array index.
891
+ * New in MongoDB 3.2.
800
892
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayElemAt/}
801
893
  */
802
894
  $arrayElemAt: [array: ResolvesToArray<S>, idx: ResolvesToInt<S>];
@@ -809,6 +901,7 @@ export namespace Aggregation.Expression {
809
901
  export interface $arrayToObject<S> {
810
902
  /**
811
903
  * Converts an array of key value pairs to a document.
904
+ * New in MongoDB 3.4.
812
905
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/}
813
906
  */
814
907
  $arrayToObject: [array: ResolvesToArray<S>];
@@ -821,6 +914,7 @@ export namespace Aggregation.Expression {
821
914
  export interface $asin<S> {
822
915
  /**
823
916
  * Returns the inverse sin (arc sine) of a value in radians.
917
+ * New in MongoDB 4.2.
824
918
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/asin/}
825
919
  */
826
920
  $asin: ResolvesToNumber<S>;
@@ -833,6 +927,7 @@ export namespace Aggregation.Expression {
833
927
  export interface $asinh<S> {
834
928
  /**
835
929
  * Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value in radians.
930
+ * New in MongoDB 4.2.
836
931
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/asinh/}
837
932
  */
838
933
  $asinh: ResolvesToNumber<S>;
@@ -845,6 +940,7 @@ export namespace Aggregation.Expression {
845
940
  export interface $atan<S> {
846
941
  /**
847
942
  * Returns the inverse tangent (arc tangent) of a value in radians.
943
+ * New in MongoDB 4.2.
848
944
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan/}
849
945
  */
850
946
  $atan: ResolvesToNumber<S>;
@@ -857,6 +953,7 @@ export namespace Aggregation.Expression {
857
953
  export interface $atan2<S> {
858
954
  /**
859
955
  * Returns the inverse tangent (arc tangent) of y / x in radians, where y and x are the first and second values passed to the expression respectively.
956
+ * New in MongoDB 4.2.
860
957
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan2/}
861
958
  */
862
959
  $atan2: [
@@ -877,6 +974,7 @@ export namespace Aggregation.Expression {
877
974
  export interface $atanh<S> {
878
975
  /**
879
976
  * Returns the inverse hyperbolic tangent (hyperbolic arc tangent) of a value in radians.
977
+ * New in MongoDB 4.2.
880
978
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/atanh/}
881
979
  */
882
980
  $atanh: ResolvesToNumber<S>;
@@ -890,6 +988,7 @@ export namespace Aggregation.Expression {
890
988
  /**
891
989
  * Returns an average of numerical values. Ignores non-numeric values.
892
990
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
991
+ * New in MongoDB 3.2.
893
992
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/}
894
993
  */
895
994
  $avg: [...ResolvesToNumber<S>[]];
@@ -902,6 +1001,7 @@ export namespace Aggregation.Expression {
902
1001
  export interface $binarySize<S> {
903
1002
  /**
904
1003
  * Returns the size of a given string or binary data value's content in bytes.
1004
+ * New in MongoDB 4.4.
905
1005
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/binarySize/}
906
1006
  */
907
1007
  $binarySize: ResolvesToString<S> | ResolvesToBinData<S> | ResolvesToNull<S>;
@@ -959,6 +1059,68 @@ export namespace Aggregation.Expression {
959
1059
  $bitXor: [...(ResolvesToInt<S> | ResolvesToLong<S>)[]];
960
1060
  }
961
1061
 
1062
+ /**
1063
+ * A type describing the `$bottom` operator.
1064
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom-array-operator/}
1065
+ */
1066
+ export interface $bottom<S> {
1067
+ /**
1068
+ * Returns the bottom element within an array according to the specified sort order.
1069
+ * New in MongoDB 7.0.
1070
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom-array-operator/}
1071
+ */
1072
+ $bottom: {
1073
+ /**
1074
+ * Specifies the order of results, with syntax similar to $sort.
1075
+ */
1076
+ sortBy: SortBy;
1077
+
1078
+ /**
1079
+ * Represents the output for each element in the input array and can be any expression.
1080
+ */
1081
+ output: Expression<S>;
1082
+
1083
+ /**
1084
+ * An expression that resolves to the array from which to return the bottom element.
1085
+ */
1086
+ input: ResolvesToArray<S>;
1087
+ };
1088
+ }
1089
+
1090
+ /**
1091
+ * A type describing the `$bottomN` operator.
1092
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN-array-operator/}
1093
+ */
1094
+ export interface $bottomN<S> {
1095
+ /**
1096
+ * Returns an aggregation of the bottom n elements within an array, according to the specified sort order.
1097
+ * If the array contains fewer than n elements, $bottomN returns all elements in the array.
1098
+ * New in MongoDB 7.0.
1099
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN-array-operator/}
1100
+ */
1101
+ $bottomN: {
1102
+ /**
1103
+ * An expression that resolves to a positive integer. The integer specifies the number of array elements that $bottomN returns.
1104
+ */
1105
+ n: ResolvesToInt<S>;
1106
+
1107
+ /**
1108
+ * Specifies the order of results, with syntax similar to $sort.
1109
+ */
1110
+ sortBy: SortBy;
1111
+
1112
+ /**
1113
+ * Represents the output for each element in the input array and can be any expression.
1114
+ */
1115
+ output: Expression<S>;
1116
+
1117
+ /**
1118
+ * An expression that resolves to the array from which to return the bottom n elements.
1119
+ */
1120
+ input: ResolvesToArray<S>;
1121
+ };
1122
+ }
1123
+
962
1124
  /**
963
1125
  * A type describing the `$bsonSize` operator.
964
1126
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/}
@@ -966,6 +1128,7 @@ export namespace Aggregation.Expression {
966
1128
  export interface $bsonSize<S> {
967
1129
  /**
968
1130
  * Returns the size in bytes of a given document (i.e. BSON type Object) when encoded as BSON.
1131
+ * New in MongoDB 4.4.
969
1132
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/}
970
1133
  */
971
1134
  $bsonSize: ResolvesToObject<S> | ResolvesToNull<S>;
@@ -978,6 +1141,7 @@ export namespace Aggregation.Expression {
978
1141
  export interface $case<S> {
979
1142
  /**
980
1143
  * Represents a single case in a $switch expression
1144
+ * New in MongoDB 3.4.
981
1145
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/}
982
1146
  */
983
1147
  $case: {
@@ -1000,6 +1164,7 @@ export namespace Aggregation.Expression {
1000
1164
  export interface $ceil<S> {
1001
1165
  /**
1002
1166
  * Returns the smallest integer greater than or equal to the specified number.
1167
+ * New in MongoDB 3.2.
1003
1168
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/ceil/}
1004
1169
  */
1005
1170
  $ceil: ResolvesToNumber<S>;
@@ -1012,6 +1177,7 @@ export namespace Aggregation.Expression {
1012
1177
  export interface $cmp<S> {
1013
1178
  /**
1014
1179
  * Returns 0 if the two values are equivalent, 1 if the first value is greater than the second, and -1 if the first value is less than the second.
1180
+ * New in MongoDB 3.0.
1015
1181
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/cmp/}
1016
1182
  */
1017
1183
  $cmp: [expression1: Expression<S>, expression2: Expression<S>];
@@ -1024,6 +1190,7 @@ export namespace Aggregation.Expression {
1024
1190
  export interface $concat<S> {
1025
1191
  /**
1026
1192
  * Concatenates any number of strings.
1193
+ * New in MongoDB 3.4.
1027
1194
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/concat/}
1028
1195
  */
1029
1196
  $concat: [...ResolvesToString<S>[]];
@@ -1036,6 +1203,7 @@ export namespace Aggregation.Expression {
1036
1203
  export interface $concatArrays<S> {
1037
1204
  /**
1038
1205
  * Concatenates arrays to return the concatenated array.
1206
+ * New in MongoDB 3.2.
1039
1207
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/}
1040
1208
  */
1041
1209
  $concatArrays: [...ResolvesToArray<S>[]];
@@ -1048,6 +1216,7 @@ export namespace Aggregation.Expression {
1048
1216
  export interface $cond<S> {
1049
1217
  /**
1050
1218
  * A ternary operator that evaluates one expression, and depending on the result, returns the value of one of the other two expressions. Accepts either three expressions in an ordered list or three named parameters.
1219
+ * New in MongoDB 3.0.
1051
1220
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/}
1052
1221
  */
1053
1222
  $cond: { if: ResolvesToBool<S>; then: Expression<S>; else: Expression<S> };
@@ -1059,7 +1228,11 @@ export namespace Aggregation.Expression {
1059
1228
  */
1060
1229
  export interface $convert<S> {
1061
1230
  /**
1062
- * Converts a value to a specified type.
1231
+ * Converts a value to a specified type. Any type can be converted to string.
1232
+ * If the optional base argument is specified, $convert interprets the input string as a
1233
+ * number in the given base and converts it to a decimal, or converts a numeric value to a
1234
+ * string representation in that base. Supported bases are 2 (binary), 8 (octal), 10
1235
+ * (decimal), and 16 (hexadecimal).
1063
1236
  * New in MongoDB 4.0.
1064
1237
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/convert/}
1065
1238
  */
@@ -1078,6 +1251,17 @@ export namespace Aggregation.Expression {
1078
1251
  * If unspecified, $convert returns null if the input is null or missing.
1079
1252
  */
1080
1253
  onNull?: Expression<S>;
1254
+
1255
+ /**
1256
+ * The numeric base to use when converting between strings and integers. Must be one of
1257
+ * 2 (binary), 8 (octal), 10 (decimal), or 16 (hexadecimal).
1258
+ * When converting a string to a number, $convert interprets the string as a number in
1259
+ * the given base and returns the decimal equivalent.
1260
+ * When converting a number to a string, $convert returns the string representation of
1261
+ * the number in the given base.
1262
+ * If unspecified, $convert uses base 10.
1263
+ */
1264
+ base?: ResolvesToInt<S>;
1081
1265
  };
1082
1266
  }
1083
1267
 
@@ -1088,6 +1272,7 @@ export namespace Aggregation.Expression {
1088
1272
  export interface $cos<S> {
1089
1273
  /**
1090
1274
  * Returns the cosine of a value that is measured in radians.
1275
+ * New in MongoDB 4.2.
1091
1276
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/cos/}
1092
1277
  */
1093
1278
  $cos: ResolvesToNumber<S>;
@@ -1100,11 +1285,25 @@ export namespace Aggregation.Expression {
1100
1285
  export interface $cosh<S> {
1101
1286
  /**
1102
1287
  * Returns the hyperbolic cosine of a value that is measured in radians.
1288
+ * New in MongoDB 4.2.
1103
1289
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/cosh/}
1104
1290
  */
1105
1291
  $cosh: ResolvesToNumber<S>;
1106
1292
  }
1107
1293
 
1294
+ /**
1295
+ * A type describing the `$createObjectId` operator.
1296
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/createObjectId/}
1297
+ */
1298
+ export interface $createObjectId<S> {
1299
+ /**
1300
+ * Returns a random object ID
1301
+ * New in MongoDB 4.4.
1302
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/createObjectId/}
1303
+ */
1304
+ $createObjectId: Record<string, never>;
1305
+ }
1306
+
1108
1307
  /**
1109
1308
  * A type describing the `$dateAdd` operator.
1110
1309
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/}
@@ -1112,6 +1311,7 @@ export namespace Aggregation.Expression {
1112
1311
  export interface $dateAdd<S> {
1113
1312
  /**
1114
1313
  * Adds a number of time units to a date object.
1314
+ * New in MongoDB 5.0.
1115
1315
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/}
1116
1316
  */
1117
1317
  $dateAdd: {
@@ -1143,6 +1343,7 @@ export namespace Aggregation.Expression {
1143
1343
  export interface $dateDiff<S> {
1144
1344
  /**
1145
1345
  * Returns the difference between two dates.
1346
+ * New in MongoDB 5.0.
1146
1347
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/}
1147
1348
  */
1148
1349
  $dateDiff: {
@@ -1186,6 +1387,7 @@ export namespace Aggregation.Expression {
1186
1387
  export interface $dateFromParts<S> {
1187
1388
  /**
1188
1389
  * Constructs a BSON Date object given the date's constituent parts.
1390
+ * New in MongoDB 3.6.
1189
1391
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromParts/}
1190
1392
  */
1191
1393
  $dateFromParts: {
@@ -1253,6 +1455,7 @@ export namespace Aggregation.Expression {
1253
1455
  export interface $dateFromString<S> {
1254
1456
  /**
1255
1457
  * Converts a date/time string to a date object.
1458
+ * New in MongoDB 3.6.
1256
1459
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/}
1257
1460
  */
1258
1461
  $dateFromString: {
@@ -1293,6 +1496,7 @@ export namespace Aggregation.Expression {
1293
1496
  export interface $dateSubtract<S> {
1294
1497
  /**
1295
1498
  * Subtracts a number of time units from a date object.
1499
+ * New in MongoDB 5.0.
1296
1500
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/}
1297
1501
  */
1298
1502
  $dateSubtract: {
@@ -1324,6 +1528,7 @@ export namespace Aggregation.Expression {
1324
1528
  export interface $dateToParts<S> {
1325
1529
  /**
1326
1530
  * Returns a document containing the constituent parts of a date.
1531
+ * New in MongoDB 3.6.
1327
1532
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToParts/}
1328
1533
  */
1329
1534
  $dateToParts: {
@@ -1351,6 +1556,7 @@ export namespace Aggregation.Expression {
1351
1556
  export interface $dateToString<S> {
1352
1557
  /**
1353
1558
  * Returns the date as a formatted string.
1559
+ * New in MongoDB 3.0.
1354
1560
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/}
1355
1561
  */
1356
1562
  $dateToString: {
@@ -1385,6 +1591,7 @@ export namespace Aggregation.Expression {
1385
1591
  export interface $dateTrunc<S> {
1386
1592
  /**
1387
1593
  * Truncates a date.
1594
+ * New in MongoDB 5.1.
1388
1595
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateTrunc/}
1389
1596
  */
1390
1597
  $dateTrunc: {
@@ -1425,6 +1632,7 @@ export namespace Aggregation.Expression {
1425
1632
  export interface $dayOfMonth<S> {
1426
1633
  /**
1427
1634
  * Returns the day of the month for a date as a number between 1 and 31.
1635
+ * New in MongoDB 2.6.
1428
1636
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfMonth/}
1429
1637
  */
1430
1638
  $dayOfMonth: {
@@ -1447,6 +1655,7 @@ export namespace Aggregation.Expression {
1447
1655
  export interface $dayOfWeek<S> {
1448
1656
  /**
1449
1657
  * Returns the day of the week for a date as a number between 1 (Sunday) and 7 (Saturday).
1658
+ * New in MongoDB 2.6.
1450
1659
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfWeek/}
1451
1660
  */
1452
1661
  $dayOfWeek: {
@@ -1469,6 +1678,7 @@ export namespace Aggregation.Expression {
1469
1678
  export interface $dayOfYear<S> {
1470
1679
  /**
1471
1680
  * Returns the day of the year for a date as a number between 1 and 366 (leap year).
1681
+ * New in MongoDB 2.6.
1472
1682
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfYear/}
1473
1683
  */
1474
1684
  $dayOfYear: {
@@ -1491,11 +1701,39 @@ export namespace Aggregation.Expression {
1491
1701
  export interface $degreesToRadians<S> {
1492
1702
  /**
1493
1703
  * Converts a value from degrees to radians.
1704
+ * New in MongoDB 4.2.
1494
1705
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/degreesToRadians/}
1495
1706
  */
1496
1707
  $degreesToRadians: ResolvesToNumber<S>;
1497
1708
  }
1498
1709
 
1710
+ /**
1711
+ * A type describing the `$deserializeEJSON` operator.
1712
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/deserializeEJSON/}
1713
+ */
1714
+ export interface $deserializeEJSON<S> {
1715
+ /**
1716
+ * Converts Extended JSON (EJSON) format to native BSON values. Use this expression to
1717
+ * transform EJSON type wrappers into their corresponding BSON types after parsing a JSON
1718
+ * string with $convert.
1719
+ * New in MongoDB 8.3.
1720
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/deserializeEJSON/}
1721
+ */
1722
+ $deserializeEJSON: {
1723
+ /**
1724
+ * The Extended JSON value to convert to native BSON format. This should be a BSON
1725
+ * document containing EJSON type wrappers.
1726
+ */
1727
+ input: ResolvesToObject<S>;
1728
+
1729
+ /**
1730
+ * The value to return if the operation encounters an error during conversion.
1731
+ * If unspecified, the operation throws an error and stops.
1732
+ */
1733
+ onError?: Expression<S>;
1734
+ };
1735
+ }
1736
+
1499
1737
  /**
1500
1738
  * A type describing the `$divide` operator.
1501
1739
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/divide/}
@@ -1503,6 +1741,7 @@ export namespace Aggregation.Expression {
1503
1741
  export interface $divide<S> {
1504
1742
  /**
1505
1743
  * Returns the result of dividing the first number by the second. Accepts two argument expressions.
1744
+ * New in MongoDB 3.2.
1506
1745
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/divide/}
1507
1746
  */
1508
1747
  $divide: [
@@ -1521,6 +1760,7 @@ export namespace Aggregation.Expression {
1521
1760
  export interface $eq<S> {
1522
1761
  /**
1523
1762
  * Returns true if the values are equivalent.
1763
+ * New in MongoDB 2.6.
1524
1764
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/eq/}
1525
1765
  */
1526
1766
  $eq: [expression1: Expression<S>, expression2: Expression<S>];
@@ -1533,6 +1773,7 @@ export namespace Aggregation.Expression {
1533
1773
  export interface $exp<S> {
1534
1774
  /**
1535
1775
  * Raises e to the specified exponent.
1776
+ * New in MongoDB 4.2.
1536
1777
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/exp/}
1537
1778
  */
1538
1779
  $exp: ResolvesToNumber<S>;
@@ -1545,6 +1786,7 @@ export namespace Aggregation.Expression {
1545
1786
  export interface $filter<S> {
1546
1787
  /**
1547
1788
  * Selects a subset of the array to return an array with only the elements that match the filter condition.
1789
+ * New in MongoDB 3.2.
1548
1790
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/}
1549
1791
  */
1550
1792
  $filter: {
@@ -1575,6 +1817,7 @@ export namespace Aggregation.Expression {
1575
1817
  export interface $first<S> {
1576
1818
  /**
1577
1819
  * Returns the result of an expression for the first document in an array.
1820
+ * New in MongoDB 4.4.
1578
1821
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/}
1579
1822
  */
1580
1823
  $first: ResolvesToArray<S>;
@@ -1587,6 +1830,7 @@ export namespace Aggregation.Expression {
1587
1830
  export interface $firstN<S> {
1588
1831
  /**
1589
1832
  * Returns a specified number of elements from the beginning of an array.
1833
+ * New in MongoDB 5.1.
1590
1834
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN-array-element/}
1591
1835
  */
1592
1836
  $firstN: {
@@ -1609,6 +1853,7 @@ export namespace Aggregation.Expression {
1609
1853
  export interface $floor<S> {
1610
1854
  /**
1611
1855
  * Returns the largest integer less than or equal to the specified number.
1856
+ * New in MongoDB 3.2.
1612
1857
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/floor/}
1613
1858
  */
1614
1859
  $floor: ResolvesToNumber<S>;
@@ -1671,6 +1916,7 @@ export namespace Aggregation.Expression {
1671
1916
  export interface $gt<S> {
1672
1917
  /**
1673
1918
  * Returns true if the first value is greater than the second.
1919
+ * New in MongoDB 2.6.
1674
1920
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/gt/}
1675
1921
  */
1676
1922
  $gt: [expression1: Expression<S>, expression2: Expression<S>];
@@ -1683,11 +1929,48 @@ export namespace Aggregation.Expression {
1683
1929
  export interface $gte<S> {
1684
1930
  /**
1685
1931
  * Returns true if the first value is greater than or equal to the second.
1932
+ * New in MongoDB 2.6.
1686
1933
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/gte/}
1687
1934
  */
1688
1935
  $gte: [expression1: Expression<S>, expression2: Expression<S>];
1689
1936
  }
1690
1937
 
1938
+ /**
1939
+ * A type describing the `$hash` operator.
1940
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hash/}
1941
+ */
1942
+ export interface $hash<S> {
1943
+ /**
1944
+ * Generates and returns a binary hash value (BinData) from a UTF-8 string or binary data. Use $hash in an aggregation
1945
+ * pipeline to compute binary hashes for storage, verification, or comparison. To get a hexadecimal string instead of
1946
+ * binary data, use $hexHash.
1947
+ * New in MongoDB 8.3.
1948
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hash/}
1949
+ */
1950
+ $hash: {
1951
+ input: ResolvesToString<S> | ResolvesToBinData<S> | ResolvesToNull<S>;
1952
+ algorithm: string;
1953
+ };
1954
+ }
1955
+
1956
+ /**
1957
+ * A type describing the `$hexHash` operator.
1958
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hexHash/}
1959
+ */
1960
+ export interface $hexHash<S> {
1961
+ /**
1962
+ * Generates and returns an uppercase hexadecimal string representation of a hash value from a UTF-8 string or binary
1963
+ * data. Use $hexHash in an aggregation pipeline to compute hex-encoded hashes for storage, verification, or comparison.
1964
+ * To get binary data instead of a hexadecimal string, use $hash.
1965
+ * New in MongoDB 8.3.
1966
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hexHash/}
1967
+ */
1968
+ $hexHash: {
1969
+ input: ResolvesToString<S> | ResolvesToBinData<S> | ResolvesToNull<S>;
1970
+ algorithm: string;
1971
+ };
1972
+ }
1973
+
1691
1974
  /**
1692
1975
  * A type describing the `$hour` operator.
1693
1976
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/}
@@ -1695,6 +1978,7 @@ export namespace Aggregation.Expression {
1695
1978
  export interface $hour<S> {
1696
1979
  /**
1697
1980
  * Returns the hour for a date as a number between 0 and 23.
1981
+ * New in MongoDB 2.6.
1698
1982
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/}
1699
1983
  */
1700
1984
  $hour: {
@@ -1717,6 +2001,7 @@ export namespace Aggregation.Expression {
1717
2001
  export interface $ifNull<S> {
1718
2002
  /**
1719
2003
  * Returns either the non-null result of the first expression or the result of the second expression if the first expression results in a null result. Null result encompasses instances of undefined values or missing fields. Accepts two expressions as arguments. The result of the second expression can be null.
2004
+ * New in MongoDB 3.0.
1720
2005
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/ifNull/}
1721
2006
  */
1722
2007
  $ifNull: [...Expression<S>[]];
@@ -1729,6 +2014,7 @@ export namespace Aggregation.Expression {
1729
2014
  export interface $in<S> {
1730
2015
  /**
1731
2016
  * Returns a boolean indicating whether a specified value is in an array.
2017
+ * New in MongoDB 3.4.
1732
2018
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/in/}
1733
2019
  */
1734
2020
  $in: [
@@ -1751,6 +2037,7 @@ export namespace Aggregation.Expression {
1751
2037
  export interface $indexOfArray<S> {
1752
2038
  /**
1753
2039
  * Searches an array for an occurrence of a specified value and returns the array index of the first occurrence. Array indexes start at zero.
2040
+ * New in MongoDB 3.4.
1754
2041
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfArray/}
1755
2042
  */
1756
2043
  $indexOfArray: [
@@ -1783,6 +2070,7 @@ export namespace Aggregation.Expression {
1783
2070
  export interface $indexOfBytes<S> {
1784
2071
  /**
1785
2072
  * Searches a string for an occurrence of a substring and returns the UTF-8 byte index of the first occurrence. If the substring is not found, returns -1.
2073
+ * New in MongoDB 3.4.
1786
2074
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfBytes/}
1787
2075
  */
1788
2076
  $indexOfBytes: [
@@ -1819,6 +2107,7 @@ export namespace Aggregation.Expression {
1819
2107
  export interface $indexOfCP<S> {
1820
2108
  /**
1821
2109
  * Searches a string for an occurrence of a substring and returns the UTF-8 code point index of the first occurrence. If the substring is not found, returns -1
2110
+ * New in MongoDB 3.4.
1822
2111
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfCP/}
1823
2112
  */
1824
2113
  $indexOfCP: [
@@ -1855,6 +2144,7 @@ export namespace Aggregation.Expression {
1855
2144
  export interface $isArray<S> {
1856
2145
  /**
1857
2146
  * Determines if the operand is an array. Returns a boolean.
2147
+ * New in MongoDB 4.4.
1858
2148
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isArray/}
1859
2149
  */
1860
2150
  $isArray: [expression: Expression<S>];
@@ -1881,6 +2171,7 @@ export namespace Aggregation.Expression {
1881
2171
  export interface $isoDayOfWeek<S> {
1882
2172
  /**
1883
2173
  * Returns the weekday number in ISO 8601 format, ranging from 1 (for Monday) to 7 (for Sunday).
2174
+ * New in MongoDB 3.4.
1884
2175
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoDayOfWeek/}
1885
2176
  */
1886
2177
  $isoDayOfWeek: {
@@ -1903,6 +2194,7 @@ export namespace Aggregation.Expression {
1903
2194
  export interface $isoWeek<S> {
1904
2195
  /**
1905
2196
  * Returns the week number in ISO 8601 format, ranging from 1 to 53. Week numbers start at 1 with the week (Monday through Sunday) that contains the year's first Thursday.
2197
+ * New in MongoDB 3.4.
1906
2198
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeek/}
1907
2199
  */
1908
2200
  $isoWeek: {
@@ -1925,6 +2217,7 @@ export namespace Aggregation.Expression {
1925
2217
  export interface $isoWeekYear<S> {
1926
2218
  /**
1927
2219
  * Returns the year number in ISO 8601 format. The year starts with the Monday of week 1 (ISO 8601) and ends with the Sunday of the last week (ISO 8601).
2220
+ * New in MongoDB 3.4.
1928
2221
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeekYear/}
1929
2222
  */
1930
2223
  $isoWeekYear: {
@@ -1947,6 +2240,7 @@ export namespace Aggregation.Expression {
1947
2240
  export interface $last<S> {
1948
2241
  /**
1949
2242
  * Returns the result of an expression for the last document in an array.
2243
+ * New in MongoDB 4.4.
1950
2244
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/}
1951
2245
  */
1952
2246
  $last: ResolvesToArray<S>;
@@ -1959,6 +2253,7 @@ export namespace Aggregation.Expression {
1959
2253
  export interface $lastN<S> {
1960
2254
  /**
1961
2255
  * Returns a specified number of elements from the end of an array.
2256
+ * New in MongoDB 5.1.
1962
2257
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#array-operator}
1963
2258
  */
1964
2259
  $lastN: {
@@ -1982,6 +2277,7 @@ export namespace Aggregation.Expression {
1982
2277
  /**
1983
2278
  * Defines variables for use within the scope of a subexpression and returns the result of the subexpression. Accepts named parameters.
1984
2279
  * Accepts any number of argument expressions.
2280
+ * New in MongoDB 3.6.
1985
2281
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/let/}
1986
2282
  */
1987
2283
  $let: {
@@ -2005,6 +2301,7 @@ export namespace Aggregation.Expression {
2005
2301
  export interface $literal<S> {
2006
2302
  /**
2007
2303
  * Return a value without parsing. Use for values that the aggregation pipeline may interpret as an expression. For example, use a $literal expression to a string that starts with a dollar sign ($) to avoid parsing as a field path.
2304
+ * New in MongoDB 3.0.
2008
2305
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/literal/}
2009
2306
  */
2010
2307
  $literal: any;
@@ -2018,6 +2315,7 @@ export namespace Aggregation.Expression {
2018
2315
  /**
2019
2316
  * Calculates the natural log of a number.
2020
2317
  * $ln is equivalent to $log: [ <number>, Math.E ] expression, where Math.E is a JavaScript representation for Euler's number e.
2318
+ * New in MongoDB 4.2.
2021
2319
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/ln/}
2022
2320
  */
2023
2321
  $ln: ResolvesToNumber<S>;
@@ -2030,6 +2328,7 @@ export namespace Aggregation.Expression {
2030
2328
  export interface $log<S> {
2031
2329
  /**
2032
2330
  * Calculates the log of a number in the specified base.
2331
+ * New in MongoDB 4.2.
2033
2332
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/log/}
2034
2333
  */
2035
2334
  $log: [
@@ -2052,6 +2351,7 @@ export namespace Aggregation.Expression {
2052
2351
  export interface $log10<S> {
2053
2352
  /**
2054
2353
  * Calculates the log base 10 of a number.
2354
+ * New in MongoDB 4.2.
2055
2355
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/log10/}
2056
2356
  */
2057
2357
  $log10: ResolvesToNumber<S>;
@@ -2064,6 +2364,7 @@ export namespace Aggregation.Expression {
2064
2364
  export interface $lt<S> {
2065
2365
  /**
2066
2366
  * Returns true if the first value is less than the second.
2367
+ * New in MongoDB 2.6.
2067
2368
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lt/}
2068
2369
  */
2069
2370
  $lt: [expression1: Expression<S>, expression2: Expression<S>];
@@ -2076,6 +2377,7 @@ export namespace Aggregation.Expression {
2076
2377
  export interface $lte<S> {
2077
2378
  /**
2078
2379
  * Returns true if the first value is less than or equal to the second.
2380
+ * New in MongoDB 2.6.
2079
2381
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lte/}
2080
2382
  */
2081
2383
  $lte: [expression1: Expression<S>, expression2: Expression<S>];
@@ -2113,6 +2415,7 @@ export namespace Aggregation.Expression {
2113
2415
  export interface $map<S> {
2114
2416
  /**
2115
2417
  * Applies a subexpression to each element of an array and returns the array of resulting values in order. Accepts named parameters.
2418
+ * New in MongoDB 3.2.
2116
2419
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/}
2117
2420
  */
2118
2421
  $map: {
@@ -2124,7 +2427,13 @@ export namespace Aggregation.Expression {
2124
2427
  /**
2125
2428
  * A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this.
2126
2429
  */
2127
- as?: ResolvesToString<S>;
2430
+ as?: string;
2431
+
2432
+ /**
2433
+ * A name for the variable that represents the index of the current element in
2434
+ * the input array. If specified, this variable is available within the in expression.
2435
+ */
2436
+ arrayIndexAs?: string;
2128
2437
 
2129
2438
  /**
2130
2439
  * An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as.
@@ -2141,6 +2450,7 @@ export namespace Aggregation.Expression {
2141
2450
  /**
2142
2451
  * Returns the maximum value that results from applying an expression to each document.
2143
2452
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
2453
+ * New in MongoDB 3.2.
2144
2454
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/}
2145
2455
  */
2146
2456
  $max: [...Expression<S>[]];
@@ -2153,6 +2463,7 @@ export namespace Aggregation.Expression {
2153
2463
  export interface $maxN<S> {
2154
2464
  /**
2155
2465
  * Returns the n largest values in an array. Distinct from the $maxN accumulator.
2466
+ * New in MongoDB 5.1.
2156
2467
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN-array-element/}
2157
2468
  */
2158
2469
  $maxN: {
@@ -2175,18 +2486,18 @@ export namespace Aggregation.Expression {
2175
2486
  export interface $median<S> {
2176
2487
  /**
2177
2488
  * Returns an approximation of the median, the 50th percentile, as a scalar value.
2178
- * New in MongoDB 7.0.
2179
2489
  * This operator is available as an accumulator in these stages:
2180
2490
  * $group
2181
2491
  * $setWindowFields
2182
2492
  * It is also available as an aggregation expression.
2493
+ * New in MongoDB 7.0.
2183
2494
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/}
2184
2495
  */
2185
2496
  $median: {
2186
2497
  /**
2187
2498
  * $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it.
2188
2499
  */
2189
- input: ResolvesToNumber<S> | ResolvesToNumber<S>[];
2500
+ input: ResolvesToNumber<S> | unknown[];
2190
2501
 
2191
2502
  /**
2192
2503
  * The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'.
@@ -2202,6 +2513,7 @@ export namespace Aggregation.Expression {
2202
2513
  export interface $mergeObjects<S> {
2203
2514
  /**
2204
2515
  * Combines multiple documents into a single document.
2516
+ * New in MongoDB 3.4.
2205
2517
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/}
2206
2518
  */
2207
2519
  $mergeObjects: [
@@ -2219,6 +2531,7 @@ export namespace Aggregation.Expression {
2219
2531
  export interface $meta<S> {
2220
2532
  /**
2221
2533
  * Access available per-document metadata related to the aggregation operation.
2534
+ * New in MongoDB 4.4.
2222
2535
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/meta/}
2223
2536
  */
2224
2537
  $meta: string;
@@ -2231,6 +2544,7 @@ export namespace Aggregation.Expression {
2231
2544
  export interface $millisecond<S> {
2232
2545
  /**
2233
2546
  * Returns the milliseconds of a date as a number between 0 and 999.
2547
+ * New in MongoDB 2.6.
2234
2548
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/millisecond/}
2235
2549
  */
2236
2550
  $millisecond: {
@@ -2254,6 +2568,7 @@ export namespace Aggregation.Expression {
2254
2568
  /**
2255
2569
  * Returns the minimum value that results from applying an expression to each document.
2256
2570
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
2571
+ * New in MongoDB 3.2.
2257
2572
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/}
2258
2573
  */
2259
2574
  $min: [...Expression<S>[]];
@@ -2266,6 +2581,7 @@ export namespace Aggregation.Expression {
2266
2581
  export interface $minN<S> {
2267
2582
  /**
2268
2583
  * Returns the n smallest values in an array. Distinct from the $minN accumulator.
2584
+ * New in MongoDB 5.1.
2269
2585
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN-array-element/}
2270
2586
  */
2271
2587
  $minN: {
@@ -2288,6 +2604,7 @@ export namespace Aggregation.Expression {
2288
2604
  export interface $minute<S> {
2289
2605
  /**
2290
2606
  * Returns the minute for a date as a number between 0 and 59.
2607
+ * New in MongoDB 2.6.
2291
2608
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minute/}
2292
2609
  */
2293
2610
  $minute: {
@@ -2310,6 +2627,7 @@ export namespace Aggregation.Expression {
2310
2627
  export interface $mod<S> {
2311
2628
  /**
2312
2629
  * Returns the remainder of the first number divided by the second. Accepts two argument expressions.
2630
+ * New in MongoDB 3.2.
2313
2631
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/mod/}
2314
2632
  */
2315
2633
  $mod: [
@@ -2328,6 +2646,7 @@ export namespace Aggregation.Expression {
2328
2646
  export interface $month<S> {
2329
2647
  /**
2330
2648
  * Returns the month for a date as a number between 1 (January) and 12 (December).
2649
+ * New in MongoDB 2.6.
2331
2650
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/month/}
2332
2651
  */
2333
2652
  $month: {
@@ -2350,6 +2669,7 @@ export namespace Aggregation.Expression {
2350
2669
  export interface $multiply<S> {
2351
2670
  /**
2352
2671
  * Multiplies numbers to return the product. Accepts any number of argument expressions.
2672
+ * New in MongoDB 3.2.
2353
2673
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/multiply/}
2354
2674
  */
2355
2675
  $multiply: [
@@ -2368,6 +2688,7 @@ export namespace Aggregation.Expression {
2368
2688
  export interface $ne<S> {
2369
2689
  /**
2370
2690
  * Returns true if the values are not equivalent.
2691
+ * New in MongoDB 2.6.
2371
2692
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/ne/}
2372
2693
  */
2373
2694
  $ne: [expression1: Expression<S>, expression2: Expression<S>];
@@ -2380,6 +2701,7 @@ export namespace Aggregation.Expression {
2380
2701
  export interface $not<S> {
2381
2702
  /**
2382
2703
  * Returns the boolean value that is the opposite of its argument expression. Accepts a single argument expression.
2704
+ * New in MongoDB 2.6.
2383
2705
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/not/}
2384
2706
  */
2385
2707
  $not: [expression: Expression<S> | ResolvesToBool<S>];
@@ -2392,6 +2714,7 @@ export namespace Aggregation.Expression {
2392
2714
  export interface $objectToArray<S> {
2393
2715
  /**
2394
2716
  * Converts a document to an array of documents representing key-value pairs.
2717
+ * New in MongoDB 3.4.
2395
2718
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/objectToArray/}
2396
2719
  */
2397
2720
  $objectToArray: ResolvesToObject<S>;
@@ -2404,6 +2727,7 @@ export namespace Aggregation.Expression {
2404
2727
  export interface $or<S> {
2405
2728
  /**
2406
2729
  * Returns true when any of its expressions evaluates to true. Accepts any number of argument expressions.
2730
+ * New in MongoDB 2.6.
2407
2731
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/or/}
2408
2732
  */
2409
2733
  $or: [...(Expression<S> | ResolvesToBool<S>)[]];
@@ -2416,18 +2740,18 @@ export namespace Aggregation.Expression {
2416
2740
  export interface $percentile<S> {
2417
2741
  /**
2418
2742
  * Returns an array of scalar values that correspond to specified percentile values.
2419
- * New in MongoDB 7.0.
2420
2743
  * This operator is available as an accumulator in these stages:
2421
2744
  * $group
2422
2745
  * $setWindowFields
2423
2746
  * It is also available as an aggregation expression.
2747
+ * New in MongoDB 7.0.
2424
2748
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/}
2425
2749
  */
2426
2750
  $percentile: {
2427
2751
  /**
2428
2752
  * $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it.
2429
2753
  */
2430
- input: ResolvesToNumber<S> | ResolvesToNumber<S>[];
2754
+ input: ResolvesToNumber<S> | unknown[];
2431
2755
 
2432
2756
  /**
2433
2757
  * $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive.
@@ -2449,6 +2773,7 @@ export namespace Aggregation.Expression {
2449
2773
  export interface $pow<S> {
2450
2774
  /**
2451
2775
  * Raises a number to the specified exponent.
2776
+ * New in MongoDB 3.2.
2452
2777
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/pow/}
2453
2778
  */
2454
2779
  $pow: [number: ResolvesToNumber<S>, exponent: ResolvesToNumber<S>];
@@ -2461,6 +2786,7 @@ export namespace Aggregation.Expression {
2461
2786
  export interface $radiansToDegrees<S> {
2462
2787
  /**
2463
2788
  * Converts a value from radians to degrees.
2789
+ * New in MongoDB 4.2.
2464
2790
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/radiansToDegrees/}
2465
2791
  */
2466
2792
  $radiansToDegrees: ResolvesToNumber<S>;
@@ -2473,6 +2799,7 @@ export namespace Aggregation.Expression {
2473
2799
  export interface $rand<S> {
2474
2800
  /**
2475
2801
  * Returns a random float between 0 and 1
2802
+ * New in MongoDB 4.4.
2476
2803
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rand/}
2477
2804
  */
2478
2805
  $rand: Record<string, never>;
@@ -2485,6 +2812,7 @@ export namespace Aggregation.Expression {
2485
2812
  export interface $range<S> {
2486
2813
  /**
2487
2814
  * Outputs an array containing a sequence of integers according to user-defined inputs.
2815
+ * New in MongoDB 3.4.
2488
2816
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/range/}
2489
2817
  */
2490
2818
  $range: [
@@ -2512,6 +2840,7 @@ export namespace Aggregation.Expression {
2512
2840
  export interface $reduce<S> {
2513
2841
  /**
2514
2842
  * Applies an expression to each element in an array and combines them into a single value.
2843
+ * New in MongoDB 3.4.
2515
2844
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/}
2516
2845
  */
2517
2846
  $reduce: {
@@ -2537,12 +2866,12 @@ export namespace Aggregation.Expression {
2537
2866
  | Expression<
2538
2867
  S & {
2539
2868
  /**
2540
- * The variable that represents the cumulative value of the expression.
2869
+ * The variable that refers to the element being processed.
2541
2870
  */
2542
2871
  $this: any;
2543
2872
 
2544
2873
  /**
2545
- * The variable that refers to the element being processed.
2874
+ * The variable that represents the cumulative value of the expression.
2546
2875
  */
2547
2876
  $value: any;
2548
2877
  }
@@ -2550,12 +2879,12 @@ export namespace Aggregation.Expression {
2550
2879
  | ExpressionMap<
2551
2880
  S & {
2552
2881
  /**
2553
- * The variable that represents the cumulative value of the expression.
2882
+ * The variable that refers to the element being processed.
2554
2883
  */
2555
2884
  $this: any;
2556
2885
 
2557
2886
  /**
2558
- * The variable that refers to the element being processed.
2887
+ * The variable that represents the cumulative value of the expression.
2559
2888
  */
2560
2889
  $value: any;
2561
2890
  }
@@ -2655,7 +2984,7 @@ export namespace Aggregation.Expression {
2655
2984
  /**
2656
2985
  * The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null.
2657
2986
  */
2658
- find: ResolvesToString<S> | ResolvesToNull<S>;
2987
+ find: ResolvesToString<S> | ResolvesToNull<S> | ResolvesToRegex<S>;
2659
2988
 
2660
2989
  /**
2661
2990
  * The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null.
@@ -2676,17 +3005,17 @@ export namespace Aggregation.Expression {
2676
3005
  */
2677
3006
  $replaceOne: {
2678
3007
  /**
2679
- * The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null.
3008
+ * The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceOne returns null.
2680
3009
  */
2681
3010
  input: ResolvesToString<S> | ResolvesToNull<S>;
2682
3011
 
2683
3012
  /**
2684
- * The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null.
3013
+ * The string or regex to search for within the given input. Can be any valid expression that resolves to a string, a regex, or a null. If find refers to a field that is missing, $replaceOne returns null.
2685
3014
  */
2686
- find: ResolvesToString<S> | ResolvesToNull<S>;
3015
+ find: ResolvesToString<S> | ResolvesToNull<S> | ResolvesToRegex<S>;
2687
3016
 
2688
3017
  /**
2689
- * The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null.
3018
+ * The string to use to replace the first matched instance of find in input. Can be any valid expression that resolves to a string or a null.
2690
3019
  */
2691
3020
  replacement: ResolvesToString<S> | ResolvesToNull<S>;
2692
3021
  };
@@ -2699,6 +3028,7 @@ export namespace Aggregation.Expression {
2699
3028
  export interface $reverseArray<S> {
2700
3029
  /**
2701
3030
  * Returns an array with the elements in reverse order.
3031
+ * New in MongoDB 3.2.
2702
3032
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/reverseArray/}
2703
3033
  */
2704
3034
  $reverseArray: ResolvesToArray<S>;
@@ -2711,6 +3041,7 @@ export namespace Aggregation.Expression {
2711
3041
  export interface $round<S> {
2712
3042
  /**
2713
3043
  * Rounds a number to a whole integer or to a specified decimal place.
3044
+ * New in MongoDB 3.2.
2714
3045
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/round/}
2715
3046
  */
2716
3047
  $round: [
@@ -2734,6 +3065,7 @@ export namespace Aggregation.Expression {
2734
3065
  export interface $rtrim<S> {
2735
3066
  /**
2736
3067
  * Removes whitespace characters, including null, or the specified characters from the end of a string.
3068
+ * New in MongoDB 4.0.
2737
3069
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rtrim/}
2738
3070
  */
2739
3071
  $rtrim: {
@@ -2758,6 +3090,7 @@ export namespace Aggregation.Expression {
2758
3090
  export interface $second<S> {
2759
3091
  /**
2760
3092
  * Returns the seconds for a date as a number between 0 and 60 (leap seconds).
3093
+ * New in MongoDB 2.6.
2761
3094
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/second/}
2762
3095
  */
2763
3096
  $second: {
@@ -2773,6 +3106,40 @@ export namespace Aggregation.Expression {
2773
3106
  };
2774
3107
  }
2775
3108
 
3109
+ /**
3110
+ * A type describing the `$serializeEJSON` operator.
3111
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/serializeEJSON/}
3112
+ */
3113
+ export interface $serializeEJSON<S> {
3114
+ /**
3115
+ * Converts BSON values to Extended JSON (EJSON) format. The result is a
3116
+ * BSON document with EJSON type wrappers that can then be converted to
3117
+ * a JSON string using $toString.
3118
+ * New in MongoDB 8.3.
3119
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/serializeEJSON/}
3120
+ */
3121
+ $serializeEJSON: {
3122
+ /**
3123
+ * The BSON value to convert to Extended JSON format.
3124
+ */
3125
+ input: Expression<S>;
3126
+
3127
+ /**
3128
+ * Specifies whether to use Relaxed Extended JSON format. If true, numeric types
3129
+ * (Int32, Int64, Double) are represented as native JSON numbers for better readability.
3130
+ * If false or unspecified, uses Canonical Extended JSON format which preserves type
3131
+ * information for all BSON types. Defaults to false.
3132
+ */
3133
+ relaxed?: ResolvesToBool<S>;
3134
+
3135
+ /**
3136
+ * The value to return if the operation encounters an error during conversion.
3137
+ * If unspecified, the operation throws an error and stops.
3138
+ */
3139
+ onError?: Expression<S>;
3140
+ };
3141
+ }
3142
+
2776
3143
  /**
2777
3144
  * A type describing the `$setDifference` operator.
2778
3145
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/}
@@ -2780,6 +3147,7 @@ export namespace Aggregation.Expression {
2780
3147
  export interface $setDifference<S> {
2781
3148
  /**
2782
3149
  * Returns a set with elements that appear in the first set but not in the second set; i.e. performs a relative complement of the second set relative to the first. Accepts exactly two argument expressions.
3150
+ * New in MongoDB 3.0.
2783
3151
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/}
2784
3152
  */
2785
3153
  $setDifference: [
@@ -2802,6 +3170,7 @@ export namespace Aggregation.Expression {
2802
3170
  export interface $setEquals<S> {
2803
3171
  /**
2804
3172
  * Returns true if the input sets have the same distinct elements. Accepts two or more argument expressions.
3173
+ * New in MongoDB 3.0.
2805
3174
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setEquals/}
2806
3175
  */
2807
3176
  $setEquals: [...ResolvesToArray<S>[]];
@@ -2843,6 +3212,7 @@ export namespace Aggregation.Expression {
2843
3212
  export interface $setIntersection<S> {
2844
3213
  /**
2845
3214
  * Returns a set with elements that appear in all of the input sets. Accepts any number of argument expressions.
3215
+ * New in MongoDB 3.0.
2846
3216
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIntersection/}
2847
3217
  */
2848
3218
  $setIntersection: [...ResolvesToArray<S>[]];
@@ -2855,6 +3225,7 @@ export namespace Aggregation.Expression {
2855
3225
  export interface $setIsSubset<S> {
2856
3226
  /**
2857
3227
  * Returns true if all elements of the first set appear in the second set, including when the first set equals the second set; i.e. not a strict subset. Accepts exactly two argument expressions.
3228
+ * New in MongoDB 3.0.
2858
3229
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIsSubset/}
2859
3230
  */
2860
3231
  $setIsSubset: [
@@ -2870,60 +3241,153 @@ export namespace Aggregation.Expression {
2870
3241
  export interface $setUnion<S> {
2871
3242
  /**
2872
3243
  * Returns a set with elements that appear in any of the input sets.
3244
+ * New in MongoDB 3.0.
2873
3245
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/}
2874
3246
  */
2875
3247
  $setUnion: [...ResolvesToArray<S>[]];
2876
3248
  }
2877
3249
 
2878
3250
  /**
2879
- * A type describing the `$sin` operator.
2880
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/}
3251
+ * A type describing the `$sigmoid` operator.
3252
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sigmoid/}
2881
3253
  */
2882
- export interface $sin<S> {
3254
+ export interface $sigmoid<S> {
2883
3255
  /**
2884
- * Returns the sine of a value that is measured in radians.
2885
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/}
3256
+ * Returns the sigmoid of a value, defined as 1 / (1 + e^(-x)). The result is a value between 0 and 1.
3257
+ * New in MongoDB 8.1.
3258
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sigmoid/}
2886
3259
  */
2887
- $sin: ResolvesToNumber<S>;
3260
+ $sigmoid: ResolvesToNumber<S>;
2888
3261
  }
2889
3262
 
2890
3263
  /**
2891
- * A type describing the `$sinh` operator.
2892
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/}
3264
+ * A type describing the `$similarityCosine` operator.
3265
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityCosine/}
2893
3266
  */
2894
- export interface $sinh<S> {
3267
+ export interface $similarityCosine<S> {
2895
3268
  /**
2896
- * Returns the hyperbolic sine of a value that is measured in radians.
2897
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/}
3269
+ * Returns the cosine similarity between two vectors. If the score argument is true, the result
3270
+ * is normalized to a value between 0 and 1 for use as a vector search score.
3271
+ * New in MongoDB 8.3.
3272
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityCosine/}
2898
3273
  */
2899
- $sinh: ResolvesToNumber<S>;
3274
+ $similarityCosine: {
3275
+ /**
3276
+ * An array of exactly two expressions that each resolve to an array of numbers.
3277
+ * Both arrays must have the same length.
3278
+ */
3279
+ vectors: ResolvesToArray<S>;
3280
+
3281
+ /**
3282
+ * If true, normalizes the result to a value between 0 and 1 for use as a vector search score. Defaults to false.
3283
+ */
3284
+ score?: boolean;
3285
+ };
2900
3286
  }
2901
3287
 
2902
3288
  /**
2903
- * A type describing the `$size` operator.
2904
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/}
3289
+ * A type describing the `$similarityDotProduct` operator.
3290
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityDotProduct/}
2905
3291
  */
2906
- export interface $size<S> {
3292
+ export interface $similarityDotProduct<S> {
2907
3293
  /**
2908
- * Returns the number of elements in the array. Accepts a single expression as argument.
2909
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/}
3294
+ * Returns the dot product similarity between two vectors. If the score argument is true, the result
3295
+ * is normalized to a value between 0 and 1 for use as a vector search score.
3296
+ * New in MongoDB 8.3.
3297
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityDotProduct/}
2910
3298
  */
2911
- $size: ResolvesToArray<S>;
3299
+ $similarityDotProduct: {
3300
+ /**
3301
+ * An array of exactly two expressions that each resolve to an array of numbers.
3302
+ * Both arrays must have the same length.
3303
+ */
3304
+ vectors: ResolvesToArray<S>;
3305
+
3306
+ /**
3307
+ * If true, normalizes the result to a value between 0 and 1 for use as a vector search score. Defaults to false.
3308
+ */
3309
+ score?: boolean;
3310
+ };
2912
3311
  }
2913
3312
 
2914
3313
  /**
2915
- * A type describing the `$slice` operator.
2916
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/}
3314
+ * A type describing the `$similarityEuclidean` operator.
3315
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityEuclidean/}
2917
3316
  */
2918
- export interface $slice<S> {
3317
+ export interface $similarityEuclidean<S> {
2919
3318
  /**
2920
- * Returns a subset of an array.
2921
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/}
3319
+ * Returns the Euclidean similarity between two vectors. If the score argument is true, the result
3320
+ * is normalized to a value between 0 and 1 for use as a vector search score.
3321
+ * New in MongoDB 8.3.
3322
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityEuclidean/}
2922
3323
  */
2923
- $slice:
2924
- | [
2925
- /**
2926
- * Any valid expression as long as it resolves to an array.
3324
+ $similarityEuclidean: {
3325
+ /**
3326
+ * An array of exactly two expressions that each resolve to an array of numbers.
3327
+ * Both arrays must have the same length.
3328
+ */
3329
+ vectors: ResolvesToArray<S>;
3330
+
3331
+ /**
3332
+ * If true, normalizes the result to a value between 0 and 1 for use as a vector search score. Defaults to false.
3333
+ */
3334
+ score?: boolean;
3335
+ };
3336
+ }
3337
+
3338
+ /**
3339
+ * A type describing the `$sin` operator.
3340
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/}
3341
+ */
3342
+ export interface $sin<S> {
3343
+ /**
3344
+ * Returns the sine of a value that is measured in radians.
3345
+ * New in MongoDB 4.2.
3346
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/}
3347
+ */
3348
+ $sin: ResolvesToNumber<S>;
3349
+ }
3350
+
3351
+ /**
3352
+ * A type describing the `$sinh` operator.
3353
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/}
3354
+ */
3355
+ export interface $sinh<S> {
3356
+ /**
3357
+ * Returns the hyperbolic sine of a value that is measured in radians.
3358
+ * New in MongoDB 4.2.
3359
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/}
3360
+ */
3361
+ $sinh: ResolvesToNumber<S>;
3362
+ }
3363
+
3364
+ /**
3365
+ * A type describing the `$size` operator.
3366
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/}
3367
+ */
3368
+ export interface $size<S> {
3369
+ /**
3370
+ * Returns the number of elements in the array. Accepts a single expression as argument.
3371
+ * New in MongoDB 3.2.
3372
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/}
3373
+ */
3374
+ $size: ResolvesToArray<S>;
3375
+ }
3376
+
3377
+ /**
3378
+ * A type describing the `$slice` operator.
3379
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/}
3380
+ */
3381
+ export interface $slice<S> {
3382
+ /**
3383
+ * Returns a subset of an array.
3384
+ * New in MongoDB 3.2.
3385
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/}
3386
+ */
3387
+ $slice:
3388
+ | [
3389
+ /**
3390
+ * Any valid expression as long as it resolves to an array.
2927
3391
  */
2928
3392
  expression: ResolvesToArray<S>,
2929
3393
 
@@ -2963,6 +3427,7 @@ export namespace Aggregation.Expression {
2963
3427
  export interface $sortArray<S> {
2964
3428
  /**
2965
3429
  * Sorts the elements of an array.
3430
+ * New in MongoDB 5.2.
2966
3431
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/}
2967
3432
  */
2968
3433
  $sortArray: {
@@ -2987,6 +3452,7 @@ export namespace Aggregation.Expression {
2987
3452
  export interface $split<S> {
2988
3453
  /**
2989
3454
  * Splits a string into substrings based on a delimiter. Returns an array of substrings. If the delimiter is not found within the string, returns an array containing the original string.
3455
+ * New in MongoDB 3.4.
2990
3456
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/split/}
2991
3457
  */
2992
3458
  $split: [
@@ -2996,9 +3462,9 @@ export namespace Aggregation.Expression {
2996
3462
  string: ResolvesToString<S>,
2997
3463
 
2998
3464
  /**
2999
- * The delimiter to use when splitting the string expression. delimiter can be any valid expression as long as it resolves to a string.
3465
+ * The delimiter to use when splitting the string expression. delimiter can be any valid expression as long as it resolves to a string or a regular expression.
3000
3466
  */
3001
- delimiter: ResolvesToString<S>,
3467
+ delimiter: ResolvesToString<S> | ResolvesToRegex<S>,
3002
3468
  ];
3003
3469
  }
3004
3470
 
@@ -3009,6 +3475,7 @@ export namespace Aggregation.Expression {
3009
3475
  export interface $sqrt<S> {
3010
3476
  /**
3011
3477
  * Calculates the square root.
3478
+ * New in MongoDB 3.2.
3012
3479
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sqrt/}
3013
3480
  */
3014
3481
  $sqrt: ResolvesToNumber<S>;
@@ -3023,6 +3490,7 @@ export namespace Aggregation.Expression {
3023
3490
  * Calculates the population standard deviation of the input values. Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population. $stdDevPop ignores non-numeric values.
3024
3491
  * If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead.
3025
3492
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
3493
+ * New in MongoDB 5.0.
3026
3494
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/}
3027
3495
  */
3028
3496
  $stdDevPop: [...ResolvesToNumber<S>[]];
@@ -3036,6 +3504,7 @@ export namespace Aggregation.Expression {
3036
3504
  /**
3037
3505
  * Calculates the sample standard deviation of the input values. Use if the values encompass a sample of a population of data from which to generalize about the population. $stdDevSamp ignores non-numeric values.
3038
3506
  * If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead.
3507
+ * New in MongoDB 5.0.
3039
3508
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/}
3040
3509
  */
3041
3510
  $stdDevSamp: [...ResolvesToNumber<S>[]];
@@ -3048,6 +3517,7 @@ export namespace Aggregation.Expression {
3048
3517
  export interface $strLenBytes<S> {
3049
3518
  /**
3050
3519
  * Returns the number of UTF-8 encoded bytes in a string.
3520
+ * New in MongoDB 3.0.
3051
3521
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenBytes/}
3052
3522
  */
3053
3523
  $strLenBytes: ResolvesToString<S>;
@@ -3060,6 +3530,7 @@ export namespace Aggregation.Expression {
3060
3530
  export interface $strLenCP<S> {
3061
3531
  /**
3062
3532
  * Returns the number of UTF-8 code points in a string.
3533
+ * New in MongoDB 3.0.
3063
3534
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenCP/}
3064
3535
  */
3065
3536
  $strLenCP: ResolvesToString<S>;
@@ -3072,6 +3543,7 @@ export namespace Aggregation.Expression {
3072
3543
  export interface $strcasecmp<S> {
3073
3544
  /**
3074
3545
  * Performs case-insensitive string comparison and returns: 0 if two strings are equivalent, 1 if the first string is greater than the second, and -1 if the first string is less than the second.
3546
+ * New in MongoDB 3.0.
3075
3547
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/strcasecmp/}
3076
3548
  */
3077
3549
  $strcasecmp: [
@@ -3087,6 +3559,7 @@ export namespace Aggregation.Expression {
3087
3559
  export interface $substr<S> {
3088
3560
  /**
3089
3561
  * Deprecated. Use $substrBytes or $substrCP.
3562
+ * New in MongoDB 3.0.
3090
3563
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/substr/}
3091
3564
  */
3092
3565
  $substr: [
@@ -3111,6 +3584,7 @@ export namespace Aggregation.Expression {
3111
3584
  export interface $substrBytes<S> {
3112
3585
  /**
3113
3586
  * Returns the substring of a string. Starts with the character at the specified UTF-8 byte index (zero-based) in the string and continues for the specified number of bytes.
3587
+ * New in MongoDB 3.0.
3114
3588
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrBytes/}
3115
3589
  */
3116
3590
  $substrBytes: [
@@ -3135,6 +3609,7 @@ export namespace Aggregation.Expression {
3135
3609
  export interface $substrCP<S> {
3136
3610
  /**
3137
3611
  * Returns the substring of a string. Starts with the character at the specified UTF-8 code point (CP) index (zero-based) in the string and continues for the number of code points specified.
3612
+ * New in MongoDB 3.0.
3138
3613
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrCP/}
3139
3614
  */
3140
3615
  $substrCP: [
@@ -3159,6 +3634,7 @@ export namespace Aggregation.Expression {
3159
3634
  export interface $subtract<S> {
3160
3635
  /**
3161
3636
  * Returns the result of subtracting the second value from the first. If the two values are numbers, return the difference. If the two values are dates, return the difference in milliseconds. If the two values are a date and a number in milliseconds, return the resulting date. Accepts two argument expressions. If the two values are a date and a number, specify the date argument first as it is not meaningful to subtract a date from a number.
3637
+ * New in MongoDB 2.6.
3162
3638
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/}
3163
3639
  */
3164
3640
  $subtract: [
@@ -3167,6 +3643,20 @@ export namespace Aggregation.Expression {
3167
3643
  ];
3168
3644
  }
3169
3645
 
3646
+ /**
3647
+ * A type describing the `$subtype` operator.
3648
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtype/}
3649
+ */
3650
+ export interface $subtype<S> {
3651
+ /**
3652
+ * Returns the subtype of a given value as an integer. In MongoDB 8.3, the only expression
3653
+ * that contains a subtype is a BinData expression.
3654
+ * New in MongoDB 8.3.
3655
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtype/}
3656
+ */
3657
+ $subtype: ResolvesToBinData<S>;
3658
+ }
3659
+
3170
3660
  /**
3171
3661
  * A type describing the `$sum` operator.
3172
3662
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/}
@@ -3175,6 +3665,7 @@ export namespace Aggregation.Expression {
3175
3665
  /**
3176
3666
  * Returns a sum of numerical values. Ignores non-numeric values.
3177
3667
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
3668
+ * New in MongoDB 3.2.
3178
3669
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/}
3179
3670
  */
3180
3671
  $sum: [...(ResolvesToNumber<S> | ResolvesToArray<S>)[]];
@@ -3187,6 +3678,7 @@ export namespace Aggregation.Expression {
3187
3678
  export interface $switch<S> {
3188
3679
  /**
3189
3680
  * Evaluates a series of case expressions. When it finds an expression which evaluates to true, $switch executes a specified expression and breaks out of the control flow.
3681
+ * New in MongoDB 4.0.
3190
3682
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/}
3191
3683
  */
3192
3684
  $switch: {
@@ -3213,6 +3705,7 @@ export namespace Aggregation.Expression {
3213
3705
  export interface $tan<S> {
3214
3706
  /**
3215
3707
  * Returns the tangent of a value that is measured in radians.
3708
+ * New in MongoDB 4.2.
3216
3709
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/tan/}
3217
3710
  */
3218
3711
  $tan: ResolvesToNumber<S>;
@@ -3225,11 +3718,26 @@ export namespace Aggregation.Expression {
3225
3718
  export interface $tanh<S> {
3226
3719
  /**
3227
3720
  * Returns the hyperbolic tangent of a value that is measured in radians.
3721
+ * New in MongoDB 4.2.
3228
3722
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/tanh/}
3229
3723
  */
3230
3724
  $tanh: ResolvesToNumber<S>;
3231
3725
  }
3232
3726
 
3727
+ /**
3728
+ * A type describing the `$toArray` operator.
3729
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toArray/}
3730
+ */
3731
+ export interface $toArray<S> {
3732
+ /**
3733
+ * Converts a value to an array. If the value cannot be converted, $toArray errors.
3734
+ * If the value is null or missing, $toArray returns null.
3735
+ * New in MongoDB 8.3.
3736
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toArray/}
3737
+ */
3738
+ $toArray: Expression<S>;
3739
+ }
3740
+
3233
3741
  /**
3234
3742
  * A type describing the `$toBool` operator.
3235
3743
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toBool/}
@@ -3289,6 +3797,7 @@ export namespace Aggregation.Expression {
3289
3797
  export interface $toHashedIndexKey<S> {
3290
3798
  /**
3291
3799
  * Computes and returns the hash value of the input expression using the same hash function that MongoDB uses to create a hashed index. A hash function maps a key or string to a fixed-size numeric value.
3800
+ * New in MongoDB 4.4.
3292
3801
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/}
3293
3802
  */
3294
3803
  $toHashedIndexKey: Expression<S>;
@@ -3327,11 +3836,26 @@ export namespace Aggregation.Expression {
3327
3836
  export interface $toLower<S> {
3328
3837
  /**
3329
3838
  * Converts a string to lowercase. Accepts a single argument expression.
3839
+ * New in MongoDB 3.0.
3330
3840
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLower/}
3331
3841
  */
3332
3842
  $toLower: ResolvesToString<S>;
3333
3843
  }
3334
3844
 
3845
+ /**
3846
+ * A type describing the `$toObject` operator.
3847
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObject/}
3848
+ */
3849
+ export interface $toObject<S> {
3850
+ /**
3851
+ * Converts a string to an object. If the value cannot be converted, $toObject errors.
3852
+ * If the value is null or missing, $toObject returns null.
3853
+ * New in MongoDB 8.3.
3854
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObject/}
3855
+ */
3856
+ $toObject: Expression<S>;
3857
+ }
3858
+
3335
3859
  /**
3336
3860
  * A type describing the `$toObjectId` operator.
3337
3861
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObjectId/}
@@ -3365,11 +3889,74 @@ export namespace Aggregation.Expression {
3365
3889
  export interface $toUpper<S> {
3366
3890
  /**
3367
3891
  * Converts a string to uppercase. Accepts a single argument expression.
3892
+ * New in MongoDB 3.0.
3368
3893
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toUpper/}
3369
3894
  */
3370
3895
  $toUpper: ResolvesToString<S>;
3371
3896
  }
3372
3897
 
3898
+ /**
3899
+ * A type describing the `$top` operator.
3900
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/top-array-operator/}
3901
+ */
3902
+ export interface $top<S> {
3903
+ /**
3904
+ * Returns the top element within an array according to the specified sort order.
3905
+ * New in MongoDB 7.0.
3906
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/top-array-operator/}
3907
+ */
3908
+ $top: {
3909
+ /**
3910
+ * Specifies the order of results, with syntax similar to $sort.
3911
+ */
3912
+ sortBy: SortBy;
3913
+
3914
+ /**
3915
+ * Represents the output for each element in the input array and can be any expression.
3916
+ */
3917
+ output: Expression<S>;
3918
+
3919
+ /**
3920
+ * An expression that resolves to the array from which to return the top element.
3921
+ */
3922
+ input: ResolvesToArray<S>;
3923
+ };
3924
+ }
3925
+
3926
+ /**
3927
+ * A type describing the `$topN` operator.
3928
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN-array-operator/}
3929
+ */
3930
+ export interface $topN<S> {
3931
+ /**
3932
+ * Returns an aggregation of the top n elements within an array, according to the specified sort order.
3933
+ * If the array contains fewer than n elements, $topN returns all elements in the array.
3934
+ * New in MongoDB 7.0.
3935
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN-array-operator/}
3936
+ */
3937
+ $topN: {
3938
+ /**
3939
+ * An expression that resolves to a positive integer. The integer specifies the number of array elements that $topN returns.
3940
+ */
3941
+ n: ResolvesToInt<S>;
3942
+
3943
+ /**
3944
+ * Specifies the order of results, with syntax similar to $sort.
3945
+ */
3946
+ sortBy: SortBy;
3947
+
3948
+ /**
3949
+ * Represents the output for each element in the input array and can be any expression.
3950
+ */
3951
+ output: Expression<S>;
3952
+
3953
+ /**
3954
+ * An expression that resolves to the array from which to return the top n elements.
3955
+ */
3956
+ input: ResolvesToArray<S>;
3957
+ };
3958
+ }
3959
+
3373
3960
  /**
3374
3961
  * A type describing the `$trim` operator.
3375
3962
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/trim/}
@@ -3402,6 +3989,7 @@ export namespace Aggregation.Expression {
3402
3989
  export interface $trunc<S> {
3403
3990
  /**
3404
3991
  * Truncates a number to a whole integer or to a specified decimal place.
3992
+ * New in MongoDB 3.2.
3405
3993
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/trunc/}
3406
3994
  */
3407
3995
  $trunc: [
@@ -3451,6 +4039,7 @@ export namespace Aggregation.Expression {
3451
4039
  export interface $type<S> {
3452
4040
  /**
3453
4041
  * Return the BSON data type of the field.
4042
+ * New in MongoDB 3.4.
3454
4043
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/type/}
3455
4044
  */
3456
4045
  $type: Expression<S>;
@@ -3464,6 +4053,7 @@ export namespace Aggregation.Expression {
3464
4053
  /**
3465
4054
  * You can use $unsetField to remove fields with names that contain periods (.) or that start with dollar signs ($).
3466
4055
  * $unsetField is an alias for $setField using $$REMOVE to remove fields.
4056
+ * New in MongoDB 5.0.
3467
4057
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/}
3468
4058
  */
3469
4059
  $unsetField: {
@@ -3486,6 +4076,7 @@ export namespace Aggregation.Expression {
3486
4076
  export interface $week<S> {
3487
4077
  /**
3488
4078
  * Returns the week number for a date as a number between 0 (the partial week that precedes the first Sunday of the year) and 53 (leap year).
4079
+ * New in MongoDB 2.6.
3489
4080
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/week/}
3490
4081
  */
3491
4082
  $week: {
@@ -3508,6 +4099,7 @@ export namespace Aggregation.Expression {
3508
4099
  export interface $year<S> {
3509
4100
  /**
3510
4101
  * Returns the year for a date as a number (e.g. 2014).
4102
+ * New in MongoDB 2.6.
3511
4103
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/year/}
3512
4104
  */
3513
4105
  $year: {
@@ -3530,6 +4122,7 @@ export namespace Aggregation.Expression {
3530
4122
  export interface $zip<S> {
3531
4123
  /**
3532
4124
  * Merge two arrays together.
4125
+ * New in MongoDB 3.2.
3533
4126
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/zip/}
3534
4127
  */
3535
4128
  $zip: {
@@ -3563,6 +4156,7 @@ export namespace Aggregation.Query {
3563
4156
  export interface $all<S> {
3564
4157
  /**
3565
4158
  * Matches arrays that contain all elements specified in the query.
4159
+ * New in MongoDB 2.0.
3566
4160
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/all/}
3567
4161
  */
3568
4162
  $all: [...FieldQuery<S>[]];
@@ -3587,9 +4181,10 @@ export namespace Aggregation.Query {
3587
4181
  export interface $bitsAllClear<S> {
3588
4182
  /**
3589
4183
  * Matches numeric or binary values in which a set of bit positions all have a value of 0.
4184
+ * New in MongoDB 3.2.
3590
4185
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/}
3591
4186
  */
3592
- $bitsAllClear: (Int | bson.Binary) | (Int | bson.Binary)[];
4187
+ $bitsAllClear: (Int | bson.Binary) | unknown[];
3593
4188
  }
3594
4189
 
3595
4190
  /**
@@ -3599,9 +4194,10 @@ export namespace Aggregation.Query {
3599
4194
  export interface $bitsAllSet<S> {
3600
4195
  /**
3601
4196
  * Matches numeric or binary values in which a set of bit positions all have a value of 1.
4197
+ * New in MongoDB 3.2.
3602
4198
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/}
3603
4199
  */
3604
- $bitsAllSet: (Int | bson.Binary) | (Int | bson.Binary)[];
4200
+ $bitsAllSet: (Int | bson.Binary) | unknown[];
3605
4201
  }
3606
4202
 
3607
4203
  /**
@@ -3611,9 +4207,10 @@ export namespace Aggregation.Query {
3611
4207
  export interface $bitsAnyClear<S> {
3612
4208
  /**
3613
4209
  * Matches numeric or binary values in which any bit from a set of bit positions has a value of 0.
4210
+ * New in MongoDB 3.2.
3614
4211
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/}
3615
4212
  */
3616
- $bitsAnyClear: (Int | bson.Binary) | (Int | bson.Binary)[];
4213
+ $bitsAnyClear: (Int | bson.Binary) | unknown[];
3617
4214
  }
3618
4215
 
3619
4216
  /**
@@ -3623,9 +4220,10 @@ export namespace Aggregation.Query {
3623
4220
  export interface $bitsAnySet<S> {
3624
4221
  /**
3625
4222
  * Matches numeric or binary values in which any bit from a set of bit positions has a value of 1.
4223
+ * New in MongoDB 3.2.
3626
4224
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/}
3627
4225
  */
3628
- $bitsAnySet: (Int | bson.Binary) | (Int | bson.Binary)[];
4226
+ $bitsAnySet: (Int | bson.Binary) | unknown[];
3629
4227
  }
3630
4228
 
3631
4229
  /**
@@ -3635,6 +4233,7 @@ export namespace Aggregation.Query {
3635
4233
  export interface $box<S> {
3636
4234
  /**
3637
4235
  * Specifies a rectangular box using legacy coordinate pairs for $geoWithin queries. The 2d index supports $box.
4236
+ * New in MongoDB 2.4.
3638
4237
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/box/}
3639
4238
  */
3640
4239
  $box: unknown[];
@@ -3647,6 +4246,7 @@ export namespace Aggregation.Query {
3647
4246
  export interface $center<S> {
3648
4247
  /**
3649
4248
  * Specifies a circle using legacy coordinate pairs to $geoWithin queries when using planar geometry. The 2d index supports $center.
4249
+ * New in MongoDB 2.4.
3650
4250
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/center/}
3651
4251
  */
3652
4252
  $center: unknown[];
@@ -3659,11 +4259,25 @@ export namespace Aggregation.Query {
3659
4259
  export interface $centerSphere<S> {
3660
4260
  /**
3661
4261
  * Specifies a circle using either legacy coordinate pairs or GeoJSON format for $geoWithin queries when using spherical geometry. The 2dsphere and 2d indexes support $centerSphere.
4262
+ * New in MongoDB 2.4.
3662
4263
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/}
3663
4264
  */
3664
4265
  $centerSphere: unknown[];
3665
4266
  }
3666
4267
 
4268
+ /**
4269
+ * A type describing the `$comment` operator.
4270
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/comment/}
4271
+ */
4272
+ export interface $comment<S> {
4273
+ /**
4274
+ * Adds a comment to a query predicate.
4275
+ * New in MongoDB 2.6.
4276
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/comment/}
4277
+ */
4278
+ $comment: string;
4279
+ }
4280
+
3667
4281
  /**
3668
4282
  * A type describing the `$elemMatch` operator.
3669
4283
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/}
@@ -3671,6 +4285,7 @@ export namespace Aggregation.Query {
3671
4285
  export interface $elemMatch<S> {
3672
4286
  /**
3673
4287
  * The $elemMatch operator matches documents that contain an array field with at least one element that matches all the specified query criteria.
4288
+ * New in MongoDB 2.4.
3674
4289
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/}
3675
4290
  */
3676
4291
  $elemMatch: Query<S> | FieldQuery<S>;
@@ -3683,9 +4298,10 @@ export namespace Aggregation.Query {
3683
4298
  export interface $eq<S> {
3684
4299
  /**
3685
4300
  * Matches values that are equal to a specified value.
4301
+ * New in MongoDB 3.0.
3686
4302
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/eq/}
3687
4303
  */
3688
- $eq: Expression<S>;
4304
+ $eq: any;
3689
4305
  }
3690
4306
 
3691
4307
  /**
@@ -3707,6 +4323,7 @@ export namespace Aggregation.Query {
3707
4323
  export interface $expr<S> {
3708
4324
  /**
3709
4325
  * Allows use of aggregation expressions within the query language.
4326
+ * New in MongoDB 3.6.
3710
4327
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/expr/}
3711
4328
  */
3712
4329
  $expr: Expression<S>;
@@ -3719,6 +4336,7 @@ export namespace Aggregation.Query {
3719
4336
  export interface $geoIntersects<S> {
3720
4337
  /**
3721
4338
  * Selects geometries that intersect with a GeoJSON geometry. The 2dsphere index supports $geoIntersects.
4339
+ * New in MongoDB 2.6.
3722
4340
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/geoIntersects/}
3723
4341
  */
3724
4342
  $geoIntersects: Geometry<S> & {};
@@ -3731,6 +4349,7 @@ export namespace Aggregation.Query {
3731
4349
  export interface $geoWithin<S> {
3732
4350
  /**
3733
4351
  * Selects geometries within a bounding GeoJSON geometry. The 2dsphere and 2d indexes support $geoWithin.
4352
+ * New in MongoDB 2.4.
3734
4353
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/}
3735
4354
  */
3736
4355
  $geoWithin: Geometry<S> & {};
@@ -3743,6 +4362,7 @@ export namespace Aggregation.Query {
3743
4362
  export interface $geometry<S> {
3744
4363
  /**
3745
4364
  * Specifies a geometry in GeoJSON format to geospatial query operators.
4365
+ * New in MongoDB 2.6.
3746
4366
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/geometry/}
3747
4367
  */
3748
4368
  $geometry: {
@@ -3795,6 +4415,7 @@ export namespace Aggregation.Query {
3795
4415
  export interface $jsonSchema<S> {
3796
4416
  /**
3797
4417
  * Validate documents against the given JSON Schema.
4418
+ * New in MongoDB 3.6.
3798
4419
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/jsonSchema/}
3799
4420
  */
3800
4421
  $jsonSchema: Record<string, unknown>;
@@ -3831,6 +4452,7 @@ export namespace Aggregation.Query {
3831
4452
  export interface $maxDistance<S> {
3832
4453
  /**
3833
4454
  * Specifies a maximum distance to limit the results of $near and $nearSphere queries. The 2dsphere and 2d indexes support $maxDistance.
4455
+ * New in MongoDB 2.4.
3834
4456
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/maxDistance/}
3835
4457
  */
3836
4458
  $maxDistance: Number;
@@ -3843,6 +4465,7 @@ export namespace Aggregation.Query {
3843
4465
  export interface $minDistance<S> {
3844
4466
  /**
3845
4467
  * Specifies a minimum distance to limit the results of $near and $nearSphere queries. For use with 2dsphere index only.
4468
+ * New in MongoDB 2.6.
3846
4469
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/minDistance/}
3847
4470
  */
3848
4471
  $minDistance: Int | Double;
@@ -3879,6 +4502,7 @@ export namespace Aggregation.Query {
3879
4502
  export interface $near<S> {
3880
4503
  /**
3881
4504
  * Returns geospatial objects in proximity to a point. Requires a geospatial index. The 2dsphere and 2d indexes support $near.
4505
+ * New in MongoDB 2.4.
3882
4506
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/near/}
3883
4507
  */
3884
4508
  $near: Geometry<S> & {
@@ -3901,6 +4525,7 @@ export namespace Aggregation.Query {
3901
4525
  export interface $nearSphere<S> {
3902
4526
  /**
3903
4527
  * Returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The 2dsphere and 2d indexes support $nearSphere.
4528
+ * New in MongoDB 2.4.
3904
4529
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/nearSphere/}
3905
4530
  */
3906
4531
  $nearSphere: Geometry<S> & {
@@ -3971,6 +4596,7 @@ export namespace Aggregation.Query {
3971
4596
  export interface $polygon<S> {
3972
4597
  /**
3973
4598
  * Specifies a polygon to using legacy coordinate pairs for $geoWithin queries. The 2d index supports $center.
4599
+ * New in MongoDB 2.4.
3974
4600
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/polygon/}
3975
4601
  */
3976
4602
  $polygon: unknown[];
@@ -3983,6 +4609,7 @@ export namespace Aggregation.Query {
3983
4609
  export interface $rand<S> {
3984
4610
  /**
3985
4611
  * Generates a random float between 0 and 1.
4612
+ * New in MongoDB 4.4.
3986
4613
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/rand/}
3987
4614
  */
3988
4615
  $rand: Record<string, never>;
@@ -4007,6 +4634,7 @@ export namespace Aggregation.Query {
4007
4634
  export interface $sampleRate<S> {
4008
4635
  /**
4009
4636
  * Randomly select documents at a given rate. Although the exact number of documents selected varies on each run, the quantity chosen approximates the sample rate expressed as a percentage of the total number of documents.
4637
+ * New in MongoDB 5.3.
4010
4638
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sampleRate/}
4011
4639
  */
4012
4640
  $sampleRate: ResolvesToDouble<S>;
@@ -4031,6 +4659,7 @@ export namespace Aggregation.Query {
4031
4659
  export interface $text<S> {
4032
4660
  /**
4033
4661
  * Performs text search.
4662
+ * New in MongoDB 2.4.
4034
4663
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/text/}
4035
4664
  */
4036
4665
  $text: {
@@ -4065,6 +4694,7 @@ export namespace Aggregation.Query {
4065
4694
  export interface $type<S> {
4066
4695
  /**
4067
4696
  * Selects documents if a field is of the specified type.
4697
+ * New in MongoDB 3.2.
4068
4698
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/type/}
4069
4699
  */
4070
4700
  $type: [...(Int | string)[]];
@@ -4093,6 +4723,7 @@ export namespace Aggregation.Search {
4093
4723
  * contains a sequence of characters from an incomplete input string. The
4094
4724
  * fields that you intend to query with the autocomplete operator must be
4095
4725
  * indexed with the autocomplete data type in the collection's index definition.
4726
+ * New in MongoDB 5.0.
4096
4727
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/}
4097
4728
  */
4098
4729
  autocomplete: {
@@ -4113,15 +4744,17 @@ export namespace Aggregation.Search {
4113
4744
  * The compound operator combines two or more operators into a single query.
4114
4745
  * Each element of a compound query is called a clause, and each clause
4115
4746
  * consists of one or more sub-queries.
4747
+ * New in MongoDB 5.0.
4116
4748
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/compound/}
4117
4749
  */
4118
4750
  compound: {
4119
- must?: SearchOperator<S> | SearchOperator<S>[];
4120
- mustNot?: SearchOperator<S> | SearchOperator<S>[];
4121
- should?: SearchOperator<S> | SearchOperator<S>[];
4122
- filter?: SearchOperator<S> | SearchOperator<S>[];
4751
+ must?: SearchOperator<S> | unknown[];
4752
+ mustNot?: SearchOperator<S> | unknown[];
4753
+ should?: SearchOperator<S> | unknown[];
4754
+ filter?: SearchOperator<S> | unknown[];
4123
4755
  minimumShouldMatch?: Int;
4124
4756
  score?: SearchScore;
4757
+ doesNotAffect?: string | unknown[];
4125
4758
  };
4126
4759
  }
4127
4760
 
@@ -4135,6 +4768,7 @@ export namespace Aggregation.Search {
4135
4768
  * It constrains multiple query predicates to be satisfied from a single
4136
4769
  * element of an array of embedded documents. embeddedDocument can be used only
4137
4770
  * for queries over fields of the embeddedDocuments
4771
+ * New in MongoDB 5.0.
4138
4772
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/embedded-document/}
4139
4773
  */
4140
4774
  embeddedDocument: {
@@ -4151,6 +4785,7 @@ export namespace Aggregation.Search {
4151
4785
  export interface Equals<S> {
4152
4786
  /**
4153
4787
  * The equals operator checks whether a field matches a value you specify.
4788
+ * New in MongoDB 5.0.
4154
4789
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/equals/}
4155
4790
  */
4156
4791
  equals: {
@@ -4164,6 +4799,7 @@ export namespace Aggregation.Search {
4164
4799
  | Number
4165
4800
  | string;
4166
4801
  score?: SearchScore;
4802
+ doesNotAffect?: string | unknown[];
4167
4803
  };
4168
4804
  }
4169
4805
 
@@ -4174,6 +4810,7 @@ export namespace Aggregation.Search {
4174
4810
  export interface Exists<S> {
4175
4811
  /**
4176
4812
  * The exists operator tests if a path to a specified indexed field name exists in a document.
4813
+ * New in MongoDB 5.0.
4177
4814
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/exists/}
4178
4815
  */
4179
4816
  exists: { path: SearchPath<S>; score?: SearchScore };
@@ -4187,6 +4824,7 @@ export namespace Aggregation.Search {
4187
4824
  /**
4188
4825
  * The facet collector groups results by values or ranges in the specified
4189
4826
  * faceted fields and returns the count for each of those groups.
4827
+ * New in MongoDB 5.0.
4190
4828
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/facet/}
4191
4829
  */
4192
4830
  facet: { facets: Record<string, unknown>; operator?: SearchOperator<S> };
@@ -4200,6 +4838,7 @@ export namespace Aggregation.Search {
4200
4838
  /**
4201
4839
  * The geoShape operator supports querying shapes with a relation to a given
4202
4840
  * geometry if indexShapes is set to true in the index definition.
4841
+ * New in MongoDB 5.0.
4203
4842
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/geoShape/}
4204
4843
  */
4205
4844
  geoShape: {
@@ -4219,6 +4858,7 @@ export namespace Aggregation.Search {
4219
4858
  * The geoWithin operator supports querying geographic points within a given
4220
4859
  * geometry. Only points are returned, even if indexShapes value is true in
4221
4860
  * the index definition.
4861
+ * New in MongoDB 5.0.
4222
4862
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/geoWithin/}
4223
4863
  */
4224
4864
  geoWithin: {
@@ -4230,6 +4870,32 @@ export namespace Aggregation.Search {
4230
4870
  };
4231
4871
  }
4232
4872
 
4873
+ /**
4874
+ * A type describing the `hasAncestor` operator.
4875
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasancestor/}
4876
+ */
4877
+ export interface HasAncestor<S> {
4878
+ /**
4879
+ * The `hasAncestor` operator queries an `embeddedDocuments` type field specified in the `ancestorPath`. The `ancestorPath` is a parent of the field specified in the `returnScope`.
4880
+ * New in MongoDB 8.2.
4881
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasancestor/}
4882
+ */
4883
+ hasAncestor: { ancestorPath: SearchPath<S>; operator: SearchOperator<S> };
4884
+ }
4885
+
4886
+ /**
4887
+ * A type describing the `hasRoot` operator.
4888
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasroot/}
4889
+ */
4890
+ export interface HasRoot<S> {
4891
+ /**
4892
+ * The `hasRoot` operator can be used to query root-level fields when you specify the `returnScope` and `returnStoredSource` options.
4893
+ * New in MongoDB 8.2.
4894
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasroot/}
4895
+ */
4896
+ hasRoot: { operator: SearchOperator<S> };
4897
+ }
4898
+
4233
4899
  /**
4234
4900
  * A type describing the `in` operator.
4235
4901
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/in/}
@@ -4237,9 +4903,15 @@ export namespace Aggregation.Search {
4237
4903
  export interface In<S> {
4238
4904
  /**
4239
4905
  * The in operator performs a search for an array of BSON values in a field.
4906
+ * New in MongoDB 5.0.
4240
4907
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/in/}
4241
4908
  */
4242
- in: { path: SearchPath<S>; value: any | any[]; score?: SearchScore };
4909
+ in: {
4910
+ path: SearchPath<S>;
4911
+ value: any | unknown[];
4912
+ score?: SearchScore;
4913
+ doesNotAffect?: string | unknown[];
4914
+ };
4243
4915
  }
4244
4916
 
4245
4917
  /**
@@ -4251,10 +4923,11 @@ export namespace Aggregation.Search {
4251
4923
  * The moreLikeThis operator returns documents similar to input documents.
4252
4924
  * The moreLikeThis operator allows you to build features for your applications
4253
4925
  * that display similar or alternative results based on one or more given documents.
4926
+ * New in MongoDB 5.0.
4254
4927
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/moreLikeThis/}
4255
4928
  */
4256
4929
  moreLikeThis: {
4257
- like: Record<string, unknown> | Record<string, unknown>[];
4930
+ like: Record<string, unknown> | unknown[];
4258
4931
  score?: SearchScore;
4259
4932
  };
4260
4933
  }
@@ -4266,6 +4939,7 @@ export namespace Aggregation.Search {
4266
4939
  export interface Near<S> {
4267
4940
  /**
4268
4941
  * The near operator supports querying and scoring numeric, date, and GeoJSON point values.
4942
+ * New in MongoDB 5.0.
4269
4943
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/near/}
4270
4944
  */
4271
4945
  near: {
@@ -4283,11 +4957,12 @@ export namespace Aggregation.Search {
4283
4957
  export interface Phrase<S> {
4284
4958
  /**
4285
4959
  * The phrase operator performs search for documents containing an ordered sequence of terms using the analyzer specified in the index configuration.
4960
+ * New in MongoDB 5.0.
4286
4961
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/phrase/}
4287
4962
  */
4288
4963
  phrase: {
4289
4964
  path: SearchPath<S>;
4290
- query: string | string[];
4965
+ query: string | unknown[];
4291
4966
  slop?: Int;
4292
4967
  synonyms?: string;
4293
4968
  score?: SearchScore;
@@ -4310,6 +4985,7 @@ export namespace Aggregation.Search {
4310
4985
  /**
4311
4986
  * The range operator supports querying and scoring numeric, date, and string values.
4312
4987
  * You can use this operator to find results that are within a given numeric, date, objectId, or letter (from the English alphabet) range.
4988
+ * New in MongoDB 5.0.
4313
4989
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/range/}
4314
4990
  */
4315
4991
  range: {
@@ -4319,6 +4995,7 @@ export namespace Aggregation.Search {
4319
4995
  lt?: Date | Number | string | bson.ObjectId;
4320
4996
  lte?: Date | Number | string | bson.ObjectId;
4321
4997
  score?: SearchScore;
4998
+ doesNotAffect?: string | unknown[];
4322
4999
  };
4323
5000
  }
4324
5001
 
@@ -4330,6 +5007,7 @@ export namespace Aggregation.Search {
4330
5007
  /**
4331
5008
  * regex interprets the query field as a regular expression.
4332
5009
  * regex is a term-level operator, meaning that the query field isn't analyzed.
5010
+ * New in MongoDB 5.0.
4333
5011
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/regex/}
4334
5012
  */
4335
5013
  regex: {
@@ -4348,6 +5026,7 @@ export namespace Aggregation.Search {
4348
5026
  /**
4349
5027
  * The text operator performs a full-text search using the analyzer that you specify in the index configuration.
4350
5028
  * If you omit an analyzer, the text operator uses the default standard analyzer.
5029
+ * New in MongoDB 5.0.
4351
5030
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/text/}
4352
5031
  */
4353
5032
  text: {
@@ -4360,6 +5039,61 @@ export namespace Aggregation.Search {
4360
5039
  };
4361
5040
  }
4362
5041
 
5042
+ /**
5043
+ * A type describing the `vectorSearch` operator.
5044
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/vector-search/}
5045
+ */
5046
+ export interface VectorSearch<S> {
5047
+ /**
5048
+ * The vectorSearch operator performs an ANN or ENN search on a vector field. It can only be
5049
+ * used as a top-level operator in a $search or $searchMeta query, not nested under compound
5050
+ * or other operators.
5051
+ * New in MongoDB 6.0.
5052
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/vector-search/}
5053
+ */
5054
+ vectorSearch: {
5055
+ /**
5056
+ * The indexed vector field to search.
5057
+ */
5058
+ path: SearchPath<S>;
5059
+
5060
+ /**
5061
+ * Array of numbers or a BinData value that represents the query vector. The number type
5062
+ * must match the indexed field value type.
5063
+ */
5064
+ queryVector: bson.Binary | unknown[];
5065
+
5066
+ /**
5067
+ * The integer number of documents to return in the results. This value cannot exceed
5068
+ * numCandidates if numCandidates is specified.
5069
+ */
5070
+ limit: Int;
5071
+
5072
+ /**
5073
+ * If false, runs an ANN search. If true, runs an ENN search. Defaults to false.
5074
+ * This parameter is required if numCandidates is omitted.
5075
+ */
5076
+ exact?: boolean;
5077
+
5078
+ /**
5079
+ * The number of nearest neighbors to use during the search. Value must be less than or
5080
+ * equal to 10000 and cannot be less than limit. This field is required if exact is false
5081
+ * or omitted.
5082
+ */
5083
+ numCandidates?: Int;
5084
+
5085
+ /**
5086
+ * Any Atlas Search operator to filter documents based on metadata or specific search criteria.
5087
+ */
5088
+ filter?: SearchOperator<S>;
5089
+
5090
+ /**
5091
+ * Score assigned to matching search results.
5092
+ */
5093
+ score?: SearchScore;
5094
+ };
5095
+ }
5096
+
4363
5097
  /**
4364
5098
  * A type describing the `wildcard` operator.
4365
5099
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/wildcard/}
@@ -4367,6 +5101,7 @@ export namespace Aggregation.Search {
4367
5101
  export interface Wildcard<S> {
4368
5102
  /**
4369
5103
  * The wildcard operator enables queries which use special characters in the search string that can match any character.
5104
+ * New in MongoDB 5.0.
4370
5105
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/wildcard/}
4371
5106
  */
4372
5107
  wildcard: {
@@ -4385,6 +5120,7 @@ export namespace Aggregation.Stage {
4385
5120
  export interface $addFields<S> {
4386
5121
  /**
4387
5122
  * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields.
5123
+ * New in MongoDB 3.4.
4388
5124
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/}
4389
5125
  */
4390
5126
  $addFields: {
@@ -4401,6 +5137,7 @@ export namespace Aggregation.Stage {
4401
5137
  export interface $bucket<S> {
4402
5138
  /**
4403
5139
  * Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.
5140
+ * New in MongoDB 3.4.
4404
5141
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/}
4405
5142
  */
4406
5143
  $bucket: {
@@ -4440,6 +5177,7 @@ export namespace Aggregation.Stage {
4440
5177
  export interface $bucketAuto<S> {
4441
5178
  /**
4442
5179
  * Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets.
5180
+ * New in MongoDB 3.4.
4443
5181
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/}
4444
5182
  */
4445
5183
  $bucketAuto: {
@@ -4474,6 +5212,7 @@ export namespace Aggregation.Stage {
4474
5212
  export interface $changeStream<S> {
4475
5213
  /**
4476
5214
  * Returns a Change Stream cursor for the collection or database. This stage can only occur once in an aggregation pipeline and it must occur as the first stage.
5215
+ * New in MongoDB 3.6.
4477
5216
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/}
4478
5217
  */
4479
5218
  $changeStream: {
@@ -4499,7 +5238,6 @@ export namespace Aggregation.Stage {
4499
5238
 
4500
5239
  /**
4501
5240
  * Specifies whether to include additional change events, such as such as DDL and index operations.
4502
- * New in MongoDB 6.0.
4503
5241
  */
4504
5242
  showExpandedEvents?: boolean;
4505
5243
 
@@ -4523,6 +5261,7 @@ export namespace Aggregation.Stage {
4523
5261
  /**
4524
5262
  * Splits large change stream events that exceed 16 MB into smaller fragments returned in a change stream cursor.
4525
5263
  * You can only use $changeStreamSplitLargeEvent in a $changeStream pipeline and it must be the final stage in the pipeline.
5264
+ * New in MongoDB 6.1.
4526
5265
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStreamSplitLargeEvent/}
4527
5266
  */
4528
5267
  $changeStreamSplitLargeEvent: Record<string, never>;
@@ -4535,6 +5274,7 @@ export namespace Aggregation.Stage {
4535
5274
  export interface $collStats<S> {
4536
5275
  /**
4537
5276
  * Returns statistics regarding a collection or view.
5277
+ * New in MongoDB 3.4.
4538
5278
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/}
4539
5279
  */
4540
5280
  $collStats: {
@@ -4553,6 +5293,7 @@ export namespace Aggregation.Stage {
4553
5293
  /**
4554
5294
  * Returns a count of the number of documents at this stage of the aggregation pipeline.
4555
5295
  * Distinct from the $count aggregation accumulator.
5296
+ * New in MongoDB 3.4.
4556
5297
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/count/}
4557
5298
  */
4558
5299
  $count: string;
@@ -4565,6 +5306,7 @@ export namespace Aggregation.Stage {
4565
5306
  export interface $currentOp<S> {
4566
5307
  /**
4567
5308
  * Returns information on active and/or dormant operations for the MongoDB deployment. To run, use the db.aggregate() method.
5309
+ * New in MongoDB 3.2.
4568
5310
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/}
4569
5311
  */
4570
5312
  $currentOp: {
@@ -4583,6 +5325,7 @@ export namespace Aggregation.Stage {
4583
5325
  export interface $densify<S> {
4584
5326
  /**
4585
5327
  * Creates new documents in a sequence of documents where certain values in a field are missing.
5328
+ * New in MongoDB 5.1.
4586
5329
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/densify/}
4587
5330
  */
4588
5331
  $densify: {
@@ -4612,6 +5355,7 @@ export namespace Aggregation.Stage {
4612
5355
  export interface $documents<S> {
4613
5356
  /**
4614
5357
  * Returns literal documents from input values.
5358
+ * New in MongoDB 5.1.
4615
5359
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/}
4616
5360
  */
4617
5361
  $documents: ResolvesToArray<S>;
@@ -4624,6 +5368,7 @@ export namespace Aggregation.Stage {
4624
5368
  export interface $facet<S> {
4625
5369
  /**
4626
5370
  * Processes multiple aggregation pipelines within a single stage on the same set of input documents. Enables the creation of multi-faceted aggregations capable of characterizing data across multiple dimensions, or facets, in a single stage.
5371
+ * New in MongoDB 3.4.
4627
5372
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/}
4628
5373
  */
4629
5374
  $facet: {} & { [facet: string]: Pipeline<S> };
@@ -4636,6 +5381,7 @@ export namespace Aggregation.Stage {
4636
5381
  export interface $fill<S> {
4637
5382
  /**
4638
5383
  * Populates null and missing field values within documents.
5384
+ * New in MongoDB 5.3.
4639
5385
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/}
4640
5386
  */
4641
5387
  $fill: {
@@ -4673,6 +5419,7 @@ export namespace Aggregation.Stage {
4673
5419
  export interface $geoNear<S> {
4674
5420
  /**
4675
5421
  * Returns an ordered stream of documents based on the proximity to a geospatial point. Incorporates the functionality of $match, $sort, and $limit for geospatial data. The output documents include an additional distance field and can include a location identifier field.
5422
+ * New in MongoDB 2.4.
4676
5423
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/}
4677
5424
  */
4678
5425
  $geoNear: {
@@ -4736,6 +5483,7 @@ export namespace Aggregation.Stage {
4736
5483
  export interface $graphLookup<S> {
4737
5484
  /**
4738
5485
  * Performs a recursive search on a collection. To each output document, adds a new array field that contains the traversal results of the recursive search for that document.
5486
+ * New in MongoDB 3.4.
4739
5487
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/}
4740
5488
  */
4741
5489
  $graphLookup: {
@@ -4748,7 +5496,7 @@ export namespace Aggregation.Stage {
4748
5496
  /**
4749
5497
  * Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process.
4750
5498
  */
4751
- startWith: Expression<S> | Expression<S>[];
5499
+ startWith: Expression<S> | unknown[];
4752
5500
 
4753
5501
  /**
4754
5502
  * Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process.
@@ -4789,6 +5537,7 @@ export namespace Aggregation.Stage {
4789
5537
  export interface $group<S> {
4790
5538
  /**
4791
5539
  * Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields.
5540
+ * New in MongoDB 2.2.
4792
5541
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/}
4793
5542
  */
4794
5543
  $group: RecordWithStaticFields<
@@ -4796,7 +5545,7 @@ export namespace Aggregation.Stage {
4796
5545
  /**
4797
5546
  * The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents.
4798
5547
  */
4799
- _id: Expression<S> | ExpressionMap<S>;
5548
+ _id: Expression<S>;
4800
5549
  },
4801
5550
  /**
4802
5551
  * Computed using the accumulator operators.
@@ -4812,6 +5561,7 @@ export namespace Aggregation.Stage {
4812
5561
  export interface $indexStats<S> {
4813
5562
  /**
4814
5563
  * Returns statistics regarding the use of each index for the collection.
5564
+ * New in MongoDB 3.0.
4815
5565
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/}
4816
5566
  */
4817
5567
  $indexStats: Record<string, never>;
@@ -4824,6 +5574,7 @@ export namespace Aggregation.Stage {
4824
5574
  export interface $limit<S> {
4825
5575
  /**
4826
5576
  * Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents).
5577
+ * New in MongoDB 2.2.
4827
5578
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/}
4828
5579
  */
4829
5580
  $limit: Int;
@@ -4836,6 +5587,7 @@ export namespace Aggregation.Stage {
4836
5587
  export interface $listLocalSessions<S> {
4837
5588
  /**
4838
5589
  * Lists all active sessions recently in use on the currently connected mongos or mongod instance. These sessions may have not yet propagated to the system.sessions collection.
5590
+ * New in MongoDB 3.6.
4839
5591
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/}
4840
5592
  */
4841
5593
  $listLocalSessions: {
@@ -4858,6 +5610,7 @@ export namespace Aggregation.Stage {
4858
5610
  export interface $listSampledQueries<S> {
4859
5611
  /**
4860
5612
  * Lists sampled queries for all collections or a specific collection.
5613
+ * New in MongoDB 5.0.
4861
5614
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/}
4862
5615
  */
4863
5616
  $listSampledQueries: { namespace?: string };
@@ -4870,6 +5623,7 @@ export namespace Aggregation.Stage {
4870
5623
  export interface $listSearchIndexes<S> {
4871
5624
  /**
4872
5625
  * Returns information about existing Atlas Search indexes on a specified collection.
5626
+ * New in MongoDB 7.0.
4873
5627
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/}
4874
5628
  */
4875
5629
  $listSearchIndexes: {
@@ -4892,6 +5646,7 @@ export namespace Aggregation.Stage {
4892
5646
  export interface $listSessions<S> {
4893
5647
  /**
4894
5648
  * Lists all sessions that have been active long enough to propagate to the system.sessions collection.
5649
+ * New in MongoDB 3.6.
4895
5650
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/}
4896
5651
  */
4897
5652
  $listSessions: {
@@ -4914,6 +5669,7 @@ export namespace Aggregation.Stage {
4914
5669
  export interface $lookup<S> {
4915
5670
  /**
4916
5671
  * Performs a left outer join to another collection in the same database to filter in documents from the "joined" collection for processing.
5672
+ * New in MongoDB 3.2.
4917
5673
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/}
4918
5674
  */
4919
5675
  $lookup: {
@@ -4944,7 +5700,7 @@ export namespace Aggregation.Stage {
4944
5700
  * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline.
4945
5701
  * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages.
4946
5702
  */
4947
- pipeline?: UntypedPipeline;
5703
+ pipeline?: Pipeline<S>;
4948
5704
 
4949
5705
  /**
4950
5706
  * Specifies the name of the new array field to add to the input documents. The new array field contains the matching documents from the from collection. If the specified name already exists in the input document, the existing field is overwritten.
@@ -4960,6 +5716,7 @@ export namespace Aggregation.Stage {
4960
5716
  export interface $match<S> {
4961
5717
  /**
4962
5718
  * Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage. $match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match).
5719
+ * New in MongoDB 2.2.
4963
5720
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/}
4964
5721
  */
4965
5722
  $match: Query<S>;
@@ -4984,7 +5741,7 @@ export namespace Aggregation.Stage {
4984
5741
  /**
4985
5742
  * Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection.
4986
5743
  */
4987
- on?: string | string[];
5744
+ on?: string | unknown[];
4988
5745
 
4989
5746
  /**
4990
5747
  * Specifies variables for use in the whenMatched pipeline.
@@ -4994,7 +5751,7 @@ export namespace Aggregation.Stage {
4994
5751
  /**
4995
5752
  * The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s).
4996
5753
  */
4997
- whenMatched?: WhenMatched | UntypedPipeline;
5754
+ whenMatched?: WhenMatched | UpdatePipeline<S>;
4998
5755
 
4999
5756
  /**
5000
5757
  * The behavior of $merge if a result document does not match an existing document in the out collection.
@@ -5010,9 +5767,51 @@ export namespace Aggregation.Stage {
5010
5767
  export interface $out<S> {
5011
5768
  /**
5012
5769
  * Writes the resulting documents of the aggregation pipeline to a collection. To use the $out stage, it must be the last stage in the pipeline.
5770
+ * New in MongoDB 2.6.
5013
5771
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/}
5014
5772
  */
5015
- $out: string | OutCollection;
5773
+ $out: {
5774
+ /**
5775
+ * The output collection name.
5776
+ */
5777
+ coll: string;
5778
+
5779
+ /**
5780
+ * The output database name. If omitted, defaults to the current database.
5781
+ */
5782
+ db?: string;
5783
+
5784
+ /**
5785
+ * Specifies the configuration to use when writing to a time series collection.
5786
+ * The timeField is required. All other fields are optional.
5787
+ */
5788
+ timeseries?: {
5789
+ /**
5790
+ * The name of the field which contains the date in each time series document.
5791
+ */
5792
+ timeField: string;
5793
+
5794
+ /**
5795
+ * The name of the field which contains metadata in each time series document.
5796
+ */
5797
+ metaField?: string;
5798
+
5799
+ /**
5800
+ * The granularity of time measurements. Value can be seconds, minutes, or hours.
5801
+ */
5802
+ granularity?: TimeGranularity;
5803
+
5804
+ /**
5805
+ * The maximum time span between measurements in a bucket.
5806
+ */
5807
+ bucketMaxSpanSeconds?: Int;
5808
+
5809
+ /**
5810
+ * The interval that determines the starting timestamp for a new bucket.
5811
+ */
5812
+ bucketRoundingSeconds?: Int;
5813
+ };
5814
+ };
5016
5815
  }
5017
5816
 
5018
5817
  /**
@@ -5022,6 +5821,7 @@ export namespace Aggregation.Stage {
5022
5821
  export interface $planCacheStats<S> {
5023
5822
  /**
5024
5823
  * Returns plan cache information for a collection.
5824
+ * New in MongoDB 4.4.
5025
5825
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/}
5026
5826
  */
5027
5827
  $planCacheStats: Record<string, never>;
@@ -5034,10 +5834,47 @@ export namespace Aggregation.Stage {
5034
5834
  export interface $project<S> {
5035
5835
  /**
5036
5836
  * Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document.
5837
+ * New in MongoDB 2.2.
5037
5838
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/}
5038
5839
  */
5039
- $project: {} & {
5040
- [specification: string]: Expression<S> | ExpressionMap<S>;
5840
+ $project: {} & { [specification: string]: Expression<S> };
5841
+ }
5842
+
5843
+ /**
5844
+ * A type describing the `$rankFusion` operator.
5845
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rankFusion/}
5846
+ */
5847
+ export interface $rankFusion<S> {
5848
+ /**
5849
+ * Combines multiple pipelines using rank-based fusion to create hybrid search results.
5850
+ * New in MongoDB 8.1.
5851
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rankFusion/}
5852
+ */
5853
+ $rankFusion: {
5854
+ /**
5855
+ * An object that specifies the pipelines to combine with rank fusion.
5856
+ */
5857
+ input: {
5858
+ /**
5859
+ * Map from name to ranked input pipeline. Each pipeline must operate on the same collection.
5860
+ */
5861
+ pipelines: Pipeline<S>;
5862
+ };
5863
+
5864
+ /**
5865
+ * An object that specifies how to combine the ranked results.
5866
+ */
5867
+ combination?: {
5868
+ /**
5869
+ * Map from pipeline name to weight (non-negative number). If unspecified, default weight is 1 for each pipeline.
5870
+ */
5871
+ weights?: Number;
5872
+ };
5873
+
5874
+ /**
5875
+ * Set to true to include detailed scoring information.
5876
+ */
5877
+ scoreDetails?: boolean;
5041
5878
  };
5042
5879
  }
5043
5880
 
@@ -5048,6 +5885,7 @@ export namespace Aggregation.Stage {
5048
5885
  export interface $redact<S> {
5049
5886
  /**
5050
5887
  * Reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves. Incorporates the functionality of $project and $match. Can be used to implement field level redaction. For each input document, outputs either one or zero documents.
5888
+ * New in MongoDB 2.6.
5051
5889
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/}
5052
5890
  */
5053
5891
  $redact: Expression<S>;
@@ -5060,6 +5898,7 @@ export namespace Aggregation.Stage {
5060
5898
  export interface $replaceRoot<S> {
5061
5899
  /**
5062
5900
  * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level.
5901
+ * New in MongoDB 3.4.
5063
5902
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/}
5064
5903
  */
5065
5904
  $replaceRoot: { newRoot: ResolvesToObject<S> };
@@ -5073,11 +5912,50 @@ export namespace Aggregation.Stage {
5073
5912
  /**
5074
5913
  * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level.
5075
5914
  * Alias for $replaceRoot.
5915
+ * New in MongoDB 4.2.
5076
5916
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/}
5077
5917
  */
5078
5918
  $replaceWith: ResolvesToObject<S>;
5079
5919
  }
5080
5920
 
5921
+ /**
5922
+ * A type describing the `$rerank` operator.
5923
+ * @see {@link https://www.mongodb.com/docs/vector-search/query/aggregation-stages/rerank/}
5924
+ */
5925
+ export interface $rerank<S> {
5926
+ /**
5927
+ * Reranks documents using a Voyage AI reranking model to improve relevance scoring.
5928
+ * New in MongoDB 8.3.
5929
+ * @see {@link https://www.mongodb.com/docs/vector-search/query/aggregation-stages/rerank/}
5930
+ */
5931
+ $rerank: {
5932
+ /**
5933
+ * Name of the Voyage AI reranking model to use (e.g. rerank-2.5, rerank-2.5-lite).
5934
+ */
5935
+ model: string;
5936
+
5937
+ /**
5938
+ * Query object for reranking.
5939
+ */
5940
+ query: {
5941
+ /**
5942
+ * Query text used to score document relevance.
5943
+ */
5944
+ text: string;
5945
+ };
5946
+
5947
+ /**
5948
+ * Field path or array of field paths to use for reranking.
5949
+ */
5950
+ path: string | unknown[];
5951
+
5952
+ /**
5953
+ * Maximum number of documents to send to Voyage AI for reranking. Value must be between 1 and 1000.
5954
+ */
5955
+ numDocsToRerank: Int;
5956
+ };
5957
+ }
5958
+
5081
5959
  /**
5082
5960
  * A type describing the `$sample` operator.
5083
5961
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/}
@@ -5085,6 +5963,7 @@ export namespace Aggregation.Stage {
5085
5963
  export interface $sample<S> {
5086
5964
  /**
5087
5965
  * Randomly selects the specified number of documents from its input.
5966
+ * New in MongoDB 3.2.
5088
5967
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/}
5089
5968
  */
5090
5969
  $sample: {
@@ -5095,6 +5974,98 @@ export namespace Aggregation.Stage {
5095
5974
  };
5096
5975
  }
5097
5976
 
5977
+ /**
5978
+ * A type describing the `$score` operator.
5979
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/score/}
5980
+ */
5981
+ export interface $score<S> {
5982
+ /**
5983
+ * Computes and returns a new score as metadata. It also optionally normalizes the input
5984
+ * scores, by default to a range between zero and one.
5985
+ * New in MongoDB 8.2.
5986
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/score/}
5987
+ */
5988
+ $score: {
5989
+ /**
5990
+ * Computes a new value from the input scores and stores the value in the $meta keyword
5991
+ * score. Returns an error for non-numeric inputs.
5992
+ */
5993
+ score: Expression<S>;
5994
+
5995
+ /**
5996
+ * Normalizes the score to the range of 0 to 1. Value can be:
5997
+ * - none: Doesn't normalize. If omitted, defaults to none.
5998
+ * - sigmoid: Applies the sigmoid expression: 1 / (1 + e^-x).
5999
+ * - minMaxScaler: Applies the $minMaxScaler window function.
6000
+ */
6001
+ normalization?: ScoreNormalization;
6002
+
6003
+ /**
6004
+ * Number to multiply the score expression by after normalization.
6005
+ */
6006
+ weight?: Expression<S>;
6007
+
6008
+ /**
6009
+ * Specifies if $score computes and populates the $scoreDetails metadata field for each
6010
+ * output document.
6011
+ */
6012
+ scoreDetails?: boolean;
6013
+ };
6014
+ }
6015
+
6016
+ /**
6017
+ * A type describing the `$scoreFusion` operator.
6018
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/scoreFusion/}
6019
+ */
6020
+ export interface $scoreFusion<S> {
6021
+ /**
6022
+ * Combines multiple pipelines using relative score fusion to create hybrid search results.
6023
+ * New in MongoDB 8.0.
6024
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/scoreFusion/}
6025
+ */
6026
+ $scoreFusion: {
6027
+ /**
6028
+ * An object that specifies the pipelines to combine with score fusion.
6029
+ */
6030
+ input: {
6031
+ /**
6032
+ * Map from name to input pipeline. Each pipeline must be operating on the same collection.
6033
+ */
6034
+ pipelines: Pipeline<S>;
6035
+
6036
+ /**
6037
+ * Normalizes the score to the range 0 to 1 before combining the results. Value can be none, sigmoid or minMaxScaler.
6038
+ */
6039
+ normalization: string;
6040
+ };
6041
+
6042
+ /**
6043
+ * An object that specifies how to combine the scores.
6044
+ */
6045
+ combination?: {
6046
+ /**
6047
+ * Map from pipeline name to weight (non-negative number). If unspecified, default weight is 1 for each pipeline.
6048
+ */
6049
+ weights?: Number;
6050
+
6051
+ /**
6052
+ * Specifies method for combining scores. Value can be avg or expression. Default is avg.
6053
+ */
6054
+ method?: string;
6055
+
6056
+ /**
6057
+ * Custom expression used when combination.method is set to expression.
6058
+ */
6059
+ expression?: Expression<S>;
6060
+ };
6061
+
6062
+ /**
6063
+ * Set to true to include detailed scoring information.
6064
+ */
6065
+ scoreDetails?: boolean;
6066
+ };
6067
+ }
6068
+
5098
6069
  /**
5099
6070
  * A type describing the `$search` operator.
5100
6071
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/}
@@ -5103,6 +6074,7 @@ export namespace Aggregation.Stage {
5103
6074
  /**
5104
6075
  * Performs a full-text search of the field or fields in an Atlas collection.
5105
6076
  * NOTE: $search is only available for MongoDB Atlas clusters, and is not available for self-managed deployments.
6077
+ * New in MongoDB 5.0.
5106
6078
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/}
5107
6079
  */
5108
6080
  $search: SearchOperator<S> & {
@@ -5114,7 +6086,7 @@ export namespace Aggregation.Stage {
5114
6086
  /**
5115
6087
  * Specifies the highlighting options for displaying search terms in their original context.
5116
6088
  */
5117
- highlight?: SearchHighlight<S>;
6089
+ highlight?: Record<string, unknown>;
5118
6090
 
5119
6091
  /**
5120
6092
  * Parallelize search across segments on dedicated search nodes.
@@ -5148,6 +6120,11 @@ export namespace Aggregation.Stage {
5148
6120
  */
5149
6121
  sort?: Record<string, unknown>;
5150
6122
 
6123
+ /**
6124
+ * Object that sets the context of the query to the specified embedded document field. You must also specify `returnStoredSource` and set it to `true`.
6125
+ */
6126
+ returnScope?: Record<string, unknown>;
6127
+
5151
6128
  /**
5152
6129
  * Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search.
5153
6130
  */
@@ -5168,6 +6145,7 @@ export namespace Aggregation.Stage {
5168
6145
  /**
5169
6146
  * Returns different types of metadata result documents for the Atlas Search query against an Atlas collection.
5170
6147
  * NOTE: $searchMeta is only available for MongoDB Atlas clusters running MongoDB v4.4.9 or higher, and is not available for self-managed deployments.
6148
+ * New in MongoDB 5.0.
5171
6149
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/searchMeta/}
5172
6150
  */
5173
6151
  $searchMeta: SearchOperator<S> & {
@@ -5180,6 +6158,16 @@ export namespace Aggregation.Stage {
5180
6158
  * Document that specifies the count options for retrieving a count of the results.
5181
6159
  */
5182
6160
  count?: Record<string, unknown>;
6161
+
6162
+ /**
6163
+ * Object that sets the context of the query to the specified embedded document field. You must also specify `returnStoredSource` and set it to `true` if your cluster MongoDB version is less than 8.2.
6164
+ */
6165
+ returnScope?: Record<string, unknown>;
6166
+
6167
+ /**
6168
+ * Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search.
6169
+ */
6170
+ returnStoredSource?: boolean;
5183
6171
  };
5184
6172
  }
5185
6173
 
@@ -5191,6 +6179,7 @@ export namespace Aggregation.Stage {
5191
6179
  /**
5192
6180
  * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields.
5193
6181
  * Alias for $addFields.
6182
+ * New in MongoDB 4.2.
5194
6183
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/}
5195
6184
  */
5196
6185
  $set: {} & { [field: string]: Expression<S> };
@@ -5245,6 +6234,7 @@ export namespace Aggregation.Stage {
5245
6234
  export interface $skip<S> {
5246
6235
  /**
5247
6236
  * Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents).
6237
+ * New in MongoDB 2.2.
5248
6238
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/}
5249
6239
  */
5250
6240
  $skip: Int;
@@ -5257,6 +6247,7 @@ export namespace Aggregation.Stage {
5257
6247
  export interface $sort<S> {
5258
6248
  /**
5259
6249
  * Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document.
6250
+ * New in MongoDB 2.2.
5260
6251
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/}
5261
6252
  */
5262
6253
  $sort: {} & { [sort: string]: Expression<S> | SortSpec };
@@ -5269,6 +6260,7 @@ export namespace Aggregation.Stage {
5269
6260
  export interface $sortByCount<S> {
5270
6261
  /**
5271
6262
  * Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group.
6263
+ * New in MongoDB 3.4.
5272
6264
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/}
5273
6265
  */
5274
6266
  $sortByCount: Expression<S>;
@@ -5294,7 +6286,7 @@ export namespace Aggregation.Stage {
5294
6286
  * An aggregation pipeline to apply to the specified coll.
5295
6287
  * The pipeline cannot include the $out and $merge stages. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline.
5296
6288
  */
5297
- pipeline?: UntypedPipeline;
6289
+ pipeline?: Pipeline<S>;
5298
6290
  };
5299
6291
  }
5300
6292
 
@@ -5306,6 +6298,7 @@ export namespace Aggregation.Stage {
5306
6298
  /**
5307
6299
  * Removes or excludes fields from documents.
5308
6300
  * Alias for $project stage that removes or excludes fields.
6301
+ * New in MongoDB 4.2.
5309
6302
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/}
5310
6303
  */
5311
6304
  $unset: [...UnprefixedFieldPath<S>[]];
@@ -5318,6 +6311,7 @@ export namespace Aggregation.Stage {
5318
6311
  export interface $unwind<S> {
5319
6312
  /**
5320
6313
  * Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array.
6314
+ * New in MongoDB 2.2.
5321
6315
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/}
5322
6316
  */
5323
6317
  $unwind: {
@@ -5347,6 +6341,7 @@ export namespace Aggregation.Stage {
5347
6341
  export interface $vectorSearch<S> {
5348
6342
  /**
5349
6343
  * The $vectorSearch stage performs an ANN or ENN search on a vector in the specified field.
6344
+ * New in MongoDB 6.0.
5350
6345
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/}
5351
6346
  */
5352
6347
  $vectorSearch: {
@@ -5366,9 +6361,10 @@ export namespace Aggregation.Stage {
5366
6361
  path: string;
5367
6362
 
5368
6363
  /**
5369
- * Array of numbers that represent the query vector. The number type must match the indexed field value type.
6364
+ * Array of numbers or a BinData value that represent the query vector. The number type
6365
+ * must match the indexed field value type.
5370
6366
  */
5371
- queryVector: unknown[];
6367
+ queryVector: bson.Binary | unknown[];
5372
6368
 
5373
6369
  /**
5374
6370
  * This is required if numCandidates is omitted. false to run ANN search. true to run ENN search.
@@ -5376,7 +6372,7 @@ export namespace Aggregation.Stage {
5376
6372
  exact?: boolean;
5377
6373
 
5378
6374
  /**
5379
- * Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter.
6375
+ * Any match query that compares an indexed field with a boolean, date, objectId, number, string, or UUID to use as a pre-filter.
5380
6376
  */
5381
6377
  filter?: Query<S>;
5382
6378
 
@@ -5385,15 +6381,230 @@ export namespace Aggregation.Stage {
5385
6381
  * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit).
5386
6382
  */
5387
6383
  numCandidates?: Int;
6384
+
6385
+ /**
6386
+ * If true, the search returns only the stored source fields configured on the index directly from the index and skips a full document lookup. If omitted, the default value is false.
6387
+ */
6388
+ returnStoredSource?: boolean;
6389
+
6390
+ /**
6391
+ * Configure how MongoDB Vector Search scores documents that contain nested arrays.
6392
+ */
6393
+ nestedOptions?: {
6394
+ /**
6395
+ * Specifies how to score documents that contain nested arrays. Value can be avg or max.
6396
+ */
6397
+ scoreMode?: string;
6398
+ };
6399
+
6400
+ /**
6401
+ * Any match query that compares an indexed top-level field with a boolean, date, objectId, number, string, or UUID to use as a pre-filter. Only valid if `nestedRoot` is specified in the index definition.
6402
+ */
6403
+ parentFilter?: Query<S>;
5388
6404
  };
5389
6405
  }
5390
6406
  }
6407
+ export namespace Aggregation.Update {
6408
+ /**
6409
+ * A type describing the `$addToSet` operator.
6410
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/addToSet/}
6411
+ */
6412
+ export interface $addToSet<S> {
6413
+ /**
6414
+ * Adds a value to an array unless the value is already present.
6415
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/addToSet/}
6416
+ */
6417
+ $addToSet: {} & { [field: string]: any };
6418
+ }
6419
+
6420
+ /**
6421
+ * A type describing the `$bit` operator.
6422
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/bit/}
6423
+ */
6424
+ export interface $bit<S> {
6425
+ /**
6426
+ * Performs bitwise updates of integer values.
6427
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/bit/}
6428
+ */
6429
+ $bit: {
6430
+ /**
6431
+ * Each field maps to an object containing exactly one bitwise operation:
6432
+ * and, or, or xor.
6433
+ */
6434
+ } & { [field: string]: BitwiseOperation };
6435
+ }
6436
+
6437
+ /**
6438
+ * A type describing the `$currentDate` operator.
6439
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/currentDate/}
6440
+ */
6441
+ export interface $currentDate<S> {
6442
+ /**
6443
+ * Sets the value of a field to the current date as either a Date or Timestamp.
6444
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/currentDate/}
6445
+ */
6446
+ $currentDate: {
6447
+ /**
6448
+ * The value for each field can be either:
6449
+ * - true, to set the field to the current date.
6450
+ * - a document with $type set to "date" or "timestamp".
6451
+ */
6452
+ } & { [field: string]: boolean | Record<string, unknown> };
6453
+ }
6454
+
6455
+ /**
6456
+ * A type describing the `$inc` operator.
6457
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/inc/}
6458
+ */
6459
+ export interface $inc<S> {
6460
+ /**
6461
+ * Increments a field by the specified numeric amount.
6462
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/inc/}
6463
+ */
6464
+ $inc: {} & { [field: string]: Number };
6465
+ }
6466
+
6467
+ /**
6468
+ * A type describing the `$max` operator.
6469
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/max/}
6470
+ */
6471
+ export interface $max<S> {
6472
+ /**
6473
+ * Updates a field only if the specified value is greater than the current field value.
6474
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/max/}
6475
+ */
6476
+ $max: {} & { [field: string]: any };
6477
+ }
6478
+
6479
+ /**
6480
+ * A type describing the `$min` operator.
6481
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/min/}
6482
+ */
6483
+ export interface $min<S> {
6484
+ /**
6485
+ * Updates a field only if the specified value is less than the current field value.
6486
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/min/}
6487
+ */
6488
+ $min: {} & { [field: string]: any };
6489
+ }
6490
+
6491
+ /**
6492
+ * A type describing the `$mul` operator.
6493
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/mul/}
6494
+ */
6495
+ export interface $mul<S> {
6496
+ /**
6497
+ * Multiplies the value of a field by the specified number.
6498
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/mul/}
6499
+ */
6500
+ $mul: {} & { [field: string]: Number };
6501
+ }
6502
+
6503
+ /**
6504
+ * A type describing the `$pop` operator.
6505
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pop/}
6506
+ */
6507
+ export interface $pop<S> {
6508
+ /**
6509
+ * Removes the first or last element of an array.
6510
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pop/}
6511
+ */
6512
+ $pop: {} & { [field: string]: Int };
6513
+ }
6514
+
6515
+ /**
6516
+ * A type describing the `$pull` operator.
6517
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pull/}
6518
+ */
6519
+ export interface $pull<S> {
6520
+ /**
6521
+ * Removes all array elements that match a specified value or condition.
6522
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pull/}
6523
+ */
6524
+ $pull: {} & { [field: string]: FieldQuery<S> };
6525
+ }
6526
+
6527
+ /**
6528
+ * A type describing the `$pullAll` operator.
6529
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pullAll/}
6530
+ */
6531
+ export interface $pullAll<S> {
6532
+ /**
6533
+ * Removes all matching values from an array.
6534
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pullAll/}
6535
+ */
6536
+ $pullAll: {} & { [field: string]: unknown[] };
6537
+ }
6538
+
6539
+ /**
6540
+ * A type describing the `$push` operator.
6541
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/push/}
6542
+ */
6543
+ export interface $push<S> {
6544
+ /**
6545
+ * Appends a specified value to an array, with optional modifiers.
6546
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/push/}
6547
+ */
6548
+ $push: {} & { [field: string]: any };
6549
+ }
6550
+
6551
+ /**
6552
+ * A type describing the `$rename` operator.
6553
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/rename/}
6554
+ */
6555
+ export interface $rename<S> {
6556
+ /**
6557
+ * Renames a field.
6558
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/rename/}
6559
+ */
6560
+ $rename: {} & { [field: string]: string };
6561
+ }
6562
+
6563
+ /**
6564
+ * A type describing the `$set` operator.
6565
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/set/}
6566
+ */
6567
+ export interface $set<S> {
6568
+ /**
6569
+ * Sets the value of a field.
6570
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/set/}
6571
+ */
6572
+ $set: {} & { [field: string]: any };
6573
+ }
6574
+
6575
+ /**
6576
+ * A type describing the `$setOnInsert` operator.
6577
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/}
6578
+ */
6579
+ export interface $setOnInsert<S> {
6580
+ /**
6581
+ * Sets the value of a field if an update with upsert creates a new document.
6582
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/}
6583
+ */
6584
+ $setOnInsert: {} & { [field: string]: any };
6585
+ }
6586
+
6587
+ /**
6588
+ * A type describing the `$unset` operator.
6589
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/unset/}
6590
+ */
6591
+ export interface $unset<S> {
6592
+ /**
6593
+ * Removes the specified field from a document.
6594
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/unset/}
6595
+ */
6596
+ $unset: {} & { [field: string]: any };
6597
+ }
6598
+ }
5391
6599
 
5392
- export type Int = number | bson.Int32;
5393
- export type Double = number | bson.Double;
5394
- export type Decimal = bson.Decimal128;
5395
- export type Regex = RegExp | bson.BSONRegExp;
5396
- export type Long = bigint | bson.Long;
6600
+ export type Int = number | bson.Int32 | { $numberInt: string };
6601
+ export type Double = number | bson.Double | { $numberDouble: string };
6602
+ export type Decimal = bson.Decimal128 | { $numberDecimal: string };
6603
+ export type Regex =
6604
+ | RegExp
6605
+ | bson.BSONRegExp
6606
+ | { pattern: string; options?: string };
6607
+ export type Long = bigint | bson.Long | { $numberLong: string };
5397
6608
  export type Javascript = bson.Code | Function | string;
5398
6609
  export type Geometry<S> =
5399
6610
  | { type: 'Point'; coordinates: number[] }
@@ -5423,8 +6634,14 @@ export type SearchPath<S> =
5423
6634
  | UnprefixedFieldPath<S>
5424
6635
  | UnprefixedFieldPath<S>[]
5425
6636
  | { wildcard: string };
6637
+ export type BitwiseOperation =
6638
+ | { and: Int | Long }
6639
+ | { or: Int | Long }
6640
+ | { xor: Int | Long };
5426
6641
  export type SearchScore = unknown;
5427
6642
  export type Granularity = string;
6643
+ export type TimeGranularity = 'seconds' | 'minutes' | 'hours';
6644
+ export type ScoreNormalization = 'none' | 'sigmoid' | 'minMaxScaler';
5428
6645
  export type FullDocument = string;
5429
6646
  export type FullDocumentBeforeChange = string;
5430
6647
  export type AccumulatorPercentile = string;
@@ -5459,36 +6676,27 @@ export type Stage<S> =
5459
6676
  | Aggregation.Stage.$addFields<S>
5460
6677
  | Aggregation.Stage.$bucket<S>
5461
6678
  | Aggregation.Stage.$bucketAuto<S>
5462
- | Aggregation.Stage.$changeStream<S>
5463
- | Aggregation.Stage.$changeStreamSplitLargeEvent<S>
5464
- | Aggregation.Stage.$collStats<S>
5465
6679
  | Aggregation.Stage.$count<S>
5466
- | Aggregation.Stage.$currentOp<S>
5467
6680
  | Aggregation.Stage.$densify<S>
5468
- | Aggregation.Stage.$documents<S>
5469
6681
  | Aggregation.Stage.$facet<S>
5470
6682
  | Aggregation.Stage.$fill<S>
5471
- | Aggregation.Stage.$geoNear<S>
5472
6683
  | Aggregation.Stage.$graphLookup<S>
5473
6684
  | Aggregation.Stage.$group<S>
5474
- | Aggregation.Stage.$indexStats<S>
5475
6685
  | Aggregation.Stage.$limit<S>
5476
- | Aggregation.Stage.$listLocalSessions<S>
5477
6686
  | Aggregation.Stage.$listSampledQueries<S>
5478
6687
  | Aggregation.Stage.$listSearchIndexes<S>
5479
- | Aggregation.Stage.$listSessions<S>
5480
6688
  | Aggregation.Stage.$lookup<S>
5481
6689
  | Aggregation.Stage.$match<S>
5482
- | Aggregation.Stage.$merge<S>
5483
- | Aggregation.Stage.$out<S>
5484
6690
  | Aggregation.Stage.$planCacheStats<S>
5485
6691
  | Aggregation.Stage.$project<S>
6692
+ | Aggregation.Stage.$rankFusion<S>
5486
6693
  | Aggregation.Stage.$redact<S>
5487
6694
  | Aggregation.Stage.$replaceRoot<S>
5488
6695
  | Aggregation.Stage.$replaceWith<S>
6696
+ | Aggregation.Stage.$rerank<S>
5489
6697
  | Aggregation.Stage.$sample<S>
5490
- | Aggregation.Stage.$search<S>
5491
- | Aggregation.Stage.$searchMeta<S>
6698
+ | Aggregation.Stage.$score<S>
6699
+ | Aggregation.Stage.$scoreFusion<S>
5492
6700
  | Aggregation.Stage.$set<S>
5493
6701
  | Aggregation.Stage.$setWindowFields<S>
5494
6702
  | Aggregation.Stage.$shardedDataDistribution<S>
@@ -5497,14 +6705,15 @@ export type Stage<S> =
5497
6705
  | Aggregation.Stage.$sortByCount<S>
5498
6706
  | Aggregation.Stage.$unionWith<S>
5499
6707
  | Aggregation.Stage.$unset<S>
5500
- | Aggregation.Stage.$unwind<S>
5501
- | Aggregation.Stage.$vectorSearch<S>;
6708
+ | Aggregation.Stage.$unwind<S>;
5502
6709
  export type Pipeline<S> = Stage<S>[];
6710
+ export type UpdatePipeline<S> = UpdateStage<S>[];
5503
6711
  export type UntypedPipeline = Pipeline<any>;
5504
6712
  export type Query<S> =
5505
6713
  | QueryOperator<S>
5506
6714
  | Partial<{ [k in keyof S]: Condition<S[k]> }>
5507
6715
  | Aggregation.Query.$and<S>
6716
+ | Aggregation.Query.$comment<S>
5508
6717
  | Aggregation.Query.$expr<S>
5509
6718
  | Aggregation.Query.$jsonSchema<S>
5510
6719
  | Aggregation.Query.$nor<S>
@@ -5518,6 +6727,7 @@ export type Accumulator<S> =
5518
6727
  | Aggregation.Accumulator.$avg<S>
5519
6728
  | Aggregation.Accumulator.$bottom<S>
5520
6729
  | Aggregation.Accumulator.$bottomN<S>
6730
+ | Aggregation.Accumulator.$concatArrays<S>
5521
6731
  | Aggregation.Accumulator.$count<S>
5522
6732
  | Aggregation.Accumulator.$first<S>
5523
6733
  | Aggregation.Accumulator.$firstN<S>
@@ -5531,6 +6741,7 @@ export type Accumulator<S> =
5531
6741
  | Aggregation.Accumulator.$minN<S>
5532
6742
  | Aggregation.Accumulator.$percentile<S>
5533
6743
  | Aggregation.Accumulator.$push<S>
6744
+ | Aggregation.Accumulator.$setUnion<S>
5534
6745
  | Aggregation.Accumulator.$stdDevPop<S>
5535
6746
  | Aggregation.Accumulator.$stdDevSamp<S>
5536
6747
  | Aggregation.Accumulator.$sum<S>
@@ -5602,6 +6813,10 @@ export type ResolvesToDouble<S> =
5602
6813
  | Aggregation.Expression.$radiansToDegrees<S>
5603
6814
  | Aggregation.Expression.$rand<S>
5604
6815
  | Aggregation.Expression.$round<S>
6816
+ | Aggregation.Expression.$sigmoid<S>
6817
+ | Aggregation.Expression.$similarityCosine<S>
6818
+ | Aggregation.Expression.$similarityDotProduct<S>
6819
+ | Aggregation.Expression.$similarityEuclidean<S>
5605
6820
  | Aggregation.Expression.$sin<S>
5606
6821
  | Aggregation.Expression.$sinh<S>
5607
6822
  | Aggregation.Expression.$sqrt<S>
@@ -5618,6 +6833,7 @@ export type ResolvesToString<S> =
5618
6833
  | string
5619
6834
  | Aggregation.Expression.$concat<S>
5620
6835
  | Aggregation.Expression.$dateToString<S>
6836
+ | Aggregation.Expression.$hexHash<S>
5621
6837
  | Aggregation.Expression.$ltrim<S>
5622
6838
  | Aggregation.Expression.$replaceAll<S>
5623
6839
  | Aggregation.Expression.$replaceOne<S>
@@ -5638,14 +6854,20 @@ export type ResolvesToObject<S> =
5638
6854
  | Record<string, unknown>
5639
6855
  | Aggregation.Expression.$arrayToObject<S>
5640
6856
  | Aggregation.Expression.$dateToParts<S>
6857
+ | Aggregation.Expression.$deserializeEJSON<S>
5641
6858
  | Aggregation.Expression.$mergeObjects<S>
5642
6859
  | Aggregation.Expression.$regexFind<S>
6860
+ | Aggregation.Expression.$serializeEJSON<S>
5643
6861
  | Aggregation.Expression.$setField<S>
6862
+ | Aggregation.Expression.$toObject<S>
5644
6863
  | Aggregation.Expression.$unsetField<S>;
5645
6864
  export type ResolvesToArray<S> =
5646
6865
  | ResolvesToAny<S>
5647
6866
  | ArrayFieldPath<S>
5648
6867
  | unknown[]
6868
+ | Aggregation.Accumulator.$concatArrays<S>
6869
+ | Aggregation.Accumulator.$setUnion<S>
6870
+ | Aggregation.Expression.$bottomN<S>
5649
6871
  | Aggregation.Expression.$concatArrays<S>
5650
6872
  | Aggregation.Expression.$filter<S>
5651
6873
  | Aggregation.Expression.$firstN<S>
@@ -5664,15 +6886,19 @@ export type ResolvesToArray<S> =
5664
6886
  | Aggregation.Expression.$slice<S>
5665
6887
  | Aggregation.Expression.$sortArray<S>
5666
6888
  | Aggregation.Expression.$split<S>
6889
+ | Aggregation.Expression.$toArray<S>
6890
+ | Aggregation.Expression.$topN<S>
5667
6891
  | Aggregation.Expression.$zip<S>;
5668
6892
  export type ResolvesToBinData<S> =
5669
6893
  | ResolvesToAny<S>
5670
6894
  | BinDataFieldPath<S>
5671
- | bson.Binary;
6895
+ | bson.Binary
6896
+ | Aggregation.Expression.$hash<S>;
5672
6897
  export type ResolvesToObjectId<S> =
5673
6898
  | ResolvesToAny<S>
5674
6899
  | ObjectIdFieldPath<S>
5675
6900
  | bson.ObjectId
6901
+ | Aggregation.Expression.$createObjectId<S>
5676
6902
  | Aggregation.Expression.$toObjectId<S>;
5677
6903
  export type ResolvesToBool<S> =
5678
6904
  | ResolvesToAny<S>
@@ -5751,6 +6977,7 @@ export type ResolvesToInt<S> =
5751
6977
  | Aggregation.Expression.$strLenCP<S>
5752
6978
  | Aggregation.Expression.$strcasecmp<S>
5753
6979
  | Aggregation.Expression.$subtract<S>
6980
+ | Aggregation.Expression.$subtype<S>
5754
6981
  | Aggregation.Expression.$toInt<S>
5755
6982
  | Aggregation.Expression.$week<S>
5756
6983
  | Aggregation.Expression.$year<S>;
@@ -5804,6 +7031,7 @@ export type AccumulatorOperator<S> =
5804
7031
  | Aggregation.Accumulator.$avg<S>
5805
7032
  | Aggregation.Accumulator.$bottom<S>
5806
7033
  | Aggregation.Accumulator.$bottomN<S>
7034
+ | Aggregation.Accumulator.$concatArrays<S>
5807
7035
  | Aggregation.Accumulator.$count<S>
5808
7036
  | Aggregation.Accumulator.$covariancePop<S>
5809
7037
  | Aggregation.Accumulator.$covarianceSamp<S>
@@ -5823,10 +7051,12 @@ export type AccumulatorOperator<S> =
5823
7051
  | Aggregation.Accumulator.$median<S>
5824
7052
  | Aggregation.Accumulator.$mergeObjects<S>
5825
7053
  | Aggregation.Accumulator.$min<S>
7054
+ | Aggregation.Accumulator.$minMaxScaler<S>
5826
7055
  | Aggregation.Accumulator.$minN<S>
5827
7056
  | Aggregation.Accumulator.$percentile<S>
5828
7057
  | Aggregation.Accumulator.$push<S>
5829
7058
  | Aggregation.Accumulator.$rank<S>
7059
+ | Aggregation.Accumulator.$setUnion<S>
5830
7060
  | Aggregation.Accumulator.$shift<S>
5831
7061
  | Aggregation.Accumulator.$stdDevPop<S>
5832
7062
  | Aggregation.Accumulator.$stdDevSamp<S>
@@ -5838,6 +7068,7 @@ export type Window<S> =
5838
7068
  | Aggregation.Accumulator.$avg<S>
5839
7069
  | Aggregation.Accumulator.$bottom<S>
5840
7070
  | Aggregation.Accumulator.$bottomN<S>
7071
+ | Aggregation.Accumulator.$concatArrays<S>
5841
7072
  | Aggregation.Accumulator.$count<S>
5842
7073
  | Aggregation.Accumulator.$covariancePop<S>
5843
7074
  | Aggregation.Accumulator.$covarianceSamp<S>
@@ -5856,10 +7087,12 @@ export type Window<S> =
5856
7087
  | Aggregation.Accumulator.$maxN<S>
5857
7088
  | Aggregation.Accumulator.$median<S>
5858
7089
  | Aggregation.Accumulator.$min<S>
7090
+ | Aggregation.Accumulator.$minMaxScaler<S>
5859
7091
  | Aggregation.Accumulator.$minN<S>
5860
7092
  | Aggregation.Accumulator.$percentile<S>
5861
7093
  | Aggregation.Accumulator.$push<S>
5862
7094
  | Aggregation.Accumulator.$rank<S>
7095
+ | Aggregation.Accumulator.$setUnion<S>
5863
7096
  | Aggregation.Accumulator.$shift<S>
5864
7097
  | Aggregation.Accumulator.$stdDevPop<S>
5865
7098
  | Aggregation.Accumulator.$stdDevSamp<S>
@@ -5885,6 +7118,8 @@ export type ExpressionOperator<S> =
5885
7118
  | Aggregation.Expression.$bitNot<S>
5886
7119
  | Aggregation.Expression.$bitOr<S>
5887
7120
  | Aggregation.Expression.$bitXor<S>
7121
+ | Aggregation.Expression.$bottom<S>
7122
+ | Aggregation.Expression.$bottomN<S>
5888
7123
  | Aggregation.Expression.$bsonSize<S>
5889
7124
  | Aggregation.Expression.$case<S>
5890
7125
  | Aggregation.Expression.$ceil<S>
@@ -5895,6 +7130,7 @@ export type ExpressionOperator<S> =
5895
7130
  | Aggregation.Expression.$convert<S>
5896
7131
  | Aggregation.Expression.$cos<S>
5897
7132
  | Aggregation.Expression.$cosh<S>
7133
+ | Aggregation.Expression.$createObjectId<S>
5898
7134
  | Aggregation.Expression.$dateAdd<S>
5899
7135
  | Aggregation.Expression.$dateDiff<S>
5900
7136
  | Aggregation.Expression.$dateFromParts<S>
@@ -5907,6 +7143,7 @@ export type ExpressionOperator<S> =
5907
7143
  | Aggregation.Expression.$dayOfWeek<S>
5908
7144
  | Aggregation.Expression.$dayOfYear<S>
5909
7145
  | Aggregation.Expression.$degreesToRadians<S>
7146
+ | Aggregation.Expression.$deserializeEJSON<S>
5910
7147
  | Aggregation.Expression.$divide<S>
5911
7148
  | Aggregation.Expression.$eq<S>
5912
7149
  | Aggregation.Expression.$exp<S>
@@ -5918,6 +7155,8 @@ export type ExpressionOperator<S> =
5918
7155
  | Aggregation.Expression.$getField<S>
5919
7156
  | Aggregation.Expression.$gt<S>
5920
7157
  | Aggregation.Expression.$gte<S>
7158
+ | Aggregation.Expression.$hash<S>
7159
+ | Aggregation.Expression.$hexHash<S>
5921
7160
  | Aggregation.Expression.$hour<S>
5922
7161
  | Aggregation.Expression.$ifNull<S>
5923
7162
  | Aggregation.Expression.$in<S>
@@ -5971,12 +7210,17 @@ export type ExpressionOperator<S> =
5971
7210
  | Aggregation.Expression.$round<S>
5972
7211
  | Aggregation.Expression.$rtrim<S>
5973
7212
  | Aggregation.Expression.$second<S>
7213
+ | Aggregation.Expression.$serializeEJSON<S>
5974
7214
  | Aggregation.Expression.$setDifference<S>
5975
7215
  | Aggregation.Expression.$setEquals<S>
5976
7216
  | Aggregation.Expression.$setField<S>
5977
7217
  | Aggregation.Expression.$setIntersection<S>
5978
7218
  | Aggregation.Expression.$setIsSubset<S>
5979
7219
  | Aggregation.Expression.$setUnion<S>
7220
+ | Aggregation.Expression.$sigmoid<S>
7221
+ | Aggregation.Expression.$similarityCosine<S>
7222
+ | Aggregation.Expression.$similarityDotProduct<S>
7223
+ | Aggregation.Expression.$similarityEuclidean<S>
5980
7224
  | Aggregation.Expression.$sin<S>
5981
7225
  | Aggregation.Expression.$sinh<S>
5982
7226
  | Aggregation.Expression.$size<S>
@@ -5993,10 +7237,12 @@ export type ExpressionOperator<S> =
5993
7237
  | Aggregation.Expression.$substrBytes<S>
5994
7238
  | Aggregation.Expression.$substrCP<S>
5995
7239
  | Aggregation.Expression.$subtract<S>
7240
+ | Aggregation.Expression.$subtype<S>
5996
7241
  | Aggregation.Expression.$sum<S>
5997
7242
  | Aggregation.Expression.$switch<S>
5998
7243
  | Aggregation.Expression.$tan<S>
5999
7244
  | Aggregation.Expression.$tanh<S>
7245
+ | Aggregation.Expression.$toArray<S>
6000
7246
  | Aggregation.Expression.$toBool<S>
6001
7247
  | Aggregation.Expression.$toDate<S>
6002
7248
  | Aggregation.Expression.$toDecimal<S>
@@ -6005,9 +7251,12 @@ export type ExpressionOperator<S> =
6005
7251
  | Aggregation.Expression.$toInt<S>
6006
7252
  | Aggregation.Expression.$toLong<S>
6007
7253
  | Aggregation.Expression.$toLower<S>
7254
+ | Aggregation.Expression.$toObject<S>
6008
7255
  | Aggregation.Expression.$toObjectId<S>
6009
7256
  | Aggregation.Expression.$toString<S>
6010
7257
  | Aggregation.Expression.$toUpper<S>
7258
+ | Aggregation.Expression.$top<S>
7259
+ | Aggregation.Expression.$topN<S>
6011
7260
  | Aggregation.Expression.$trim<S>
6012
7261
  | Aggregation.Expression.$trunc<S>
6013
7262
  | Aggregation.Expression.$tsIncrement<S>
@@ -6019,6 +7268,7 @@ export type ExpressionOperator<S> =
6019
7268
  | Aggregation.Expression.$zip<S>;
6020
7269
  export type ResolvesToAny<S> =
6021
7270
  | Aggregation.Expression.$arrayElemAt<S>
7271
+ | Aggregation.Expression.$bottom<S>
6022
7272
  | Aggregation.Expression.$cond<S>
6023
7273
  | Aggregation.Expression.$convert<S>
6024
7274
  | Aggregation.Expression.$first<S>
@@ -6032,7 +7282,8 @@ export type ResolvesToAny<S> =
6032
7282
  | Aggregation.Expression.$meta<S>
6033
7283
  | Aggregation.Expression.$min<S>
6034
7284
  | Aggregation.Expression.$reduce<S>
6035
- | Aggregation.Expression.$switch<S>;
7285
+ | Aggregation.Expression.$switch<S>
7286
+ | Aggregation.Expression.$top<S>;
6036
7287
  export type SwitchBranch<S> = Aggregation.Expression.$case<S>;
6037
7288
  export type FieldQuery<S> =
6038
7289
  | Aggregation.Query.$all<S>
@@ -6071,6 +7322,7 @@ export type QueryOperator<S> =
6071
7322
  | Aggregation.Query.$box<S>
6072
7323
  | Aggregation.Query.$center<S>
6073
7324
  | Aggregation.Query.$centerSphere<S>
7325
+ | Aggregation.Query.$comment<S>
6074
7326
  | Aggregation.Query.$elemMatch<S>
6075
7327
  | Aggregation.Query.$eq<S>
6076
7328
  | Aggregation.Query.$exists<S>
@@ -6111,6 +7363,8 @@ export type SearchOperator<S> =
6111
7363
  | Aggregation.Search.Facet<S>
6112
7364
  | Aggregation.Search.GeoShape<S>
6113
7365
  | Aggregation.Search.GeoWithin<S>
7366
+ | Aggregation.Search.HasAncestor<S>
7367
+ | Aggregation.Search.HasRoot<S>
6114
7368
  | Aggregation.Search.In<S>
6115
7369
  | Aggregation.Search.MoreLikeThis<S>
6116
7370
  | Aggregation.Search.Near<S>
@@ -6119,7 +7373,15 @@ export type SearchOperator<S> =
6119
7373
  | Aggregation.Search.Range<S>
6120
7374
  | Aggregation.Search.Regex<S>
6121
7375
  | Aggregation.Search.Text<S>
7376
+ | Aggregation.Search.VectorSearch<S>
6122
7377
  | Aggregation.Search.Wildcard<S>;
7378
+ export type UpdateStage<S> =
7379
+ | Aggregation.Stage.$addFields<S>
7380
+ | Aggregation.Stage.$project<S>
7381
+ | Aggregation.Stage.$replaceRoot<S>
7382
+ | Aggregation.Stage.$replaceWith<S>
7383
+ | Aggregation.Stage.$set<S>
7384
+ | Aggregation.Stage.$unset<S>;
6123
7385
  export type StageOperator<S> =
6124
7386
  | Aggregation.Stage.$addFields<S>
6125
7387
  | Aggregation.Stage.$bucket<S>
@@ -6148,10 +7410,14 @@ export type StageOperator<S> =
6148
7410
  | Aggregation.Stage.$out<S>
6149
7411
  | Aggregation.Stage.$planCacheStats<S>
6150
7412
  | Aggregation.Stage.$project<S>
7413
+ | Aggregation.Stage.$rankFusion<S>
6151
7414
  | Aggregation.Stage.$redact<S>
6152
7415
  | Aggregation.Stage.$replaceRoot<S>
6153
7416
  | Aggregation.Stage.$replaceWith<S>
7417
+ | Aggregation.Stage.$rerank<S>
6154
7418
  | Aggregation.Stage.$sample<S>
7419
+ | Aggregation.Stage.$score<S>
7420
+ | Aggregation.Stage.$scoreFusion<S>
6155
7421
  | Aggregation.Stage.$search<S>
6156
7422
  | Aggregation.Stage.$searchMeta<S>
6157
7423
  | Aggregation.Stage.$set<S>
@@ -6164,3 +7430,51 @@ export type StageOperator<S> =
6164
7430
  | Aggregation.Stage.$unset<S>
6165
7431
  | Aggregation.Stage.$unwind<S>
6166
7432
  | Aggregation.Stage.$vectorSearch<S>;
7433
+ export type InputStage<S> =
7434
+ | Aggregation.Stage.$changeStream<S>
7435
+ | Aggregation.Stage.$collStats<S>
7436
+ | Aggregation.Stage.$currentOp<S>
7437
+ | Aggregation.Stage.$documents<S>
7438
+ | Aggregation.Stage.$geoNear<S>
7439
+ | Aggregation.Stage.$indexStats<S>
7440
+ | Aggregation.Stage.$listLocalSessions<S>
7441
+ | Aggregation.Stage.$listSessions<S>
7442
+ | Aggregation.Stage.$search<S>
7443
+ | Aggregation.Stage.$searchMeta<S>
7444
+ | Aggregation.Stage.$vectorSearch<S>;
7445
+ export type OutputStage<S> =
7446
+ | Aggregation.Stage.$changeStreamSplitLargeEvent<S>
7447
+ | Aggregation.Stage.$merge<S>
7448
+ | Aggregation.Stage.$out<S>;
7449
+ export type Update<S> =
7450
+ | Aggregation.Update.$addToSet<S>
7451
+ | Aggregation.Update.$bit<S>
7452
+ | Aggregation.Update.$currentDate<S>
7453
+ | Aggregation.Update.$inc<S>
7454
+ | Aggregation.Update.$max<S>
7455
+ | Aggregation.Update.$min<S>
7456
+ | Aggregation.Update.$mul<S>
7457
+ | Aggregation.Update.$pop<S>
7458
+ | Aggregation.Update.$pull<S>
7459
+ | Aggregation.Update.$pullAll<S>
7460
+ | Aggregation.Update.$push<S>
7461
+ | Aggregation.Update.$rename<S>
7462
+ | Aggregation.Update.$set<S>
7463
+ | Aggregation.Update.$setOnInsert<S>
7464
+ | Aggregation.Update.$unset<S>;
7465
+ export type UpdateOperator<S> =
7466
+ | Aggregation.Update.$addToSet<S>
7467
+ | Aggregation.Update.$bit<S>
7468
+ | Aggregation.Update.$currentDate<S>
7469
+ | Aggregation.Update.$inc<S>
7470
+ | Aggregation.Update.$max<S>
7471
+ | Aggregation.Update.$min<S>
7472
+ | Aggregation.Update.$mul<S>
7473
+ | Aggregation.Update.$pop<S>
7474
+ | Aggregation.Update.$pull<S>
7475
+ | Aggregation.Update.$pullAll<S>
7476
+ | Aggregation.Update.$push<S>
7477
+ | Aggregation.Update.$rename<S>
7478
+ | Aggregation.Update.$set<S>
7479
+ | Aggregation.Update.$setOnInsert<S>
7480
+ | Aggregation.Update.$unset<S>;