@mongodb-js/mql-typescript 0.5.1 → 0.6.0

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,20 +1786,27 @@ 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: {
1551
1793
  input: ResolvesToArray<S>;
1552
1794
 
1553
1795
  /**
1554
- * An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as.
1796
+ * 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.
1555
1797
  */
1556
- cond: ResolvesToBool<S>;
1798
+ as?: string;
1557
1799
 
1558
1800
  /**
1559
- * 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.
1801
+ * A name for the variable that represents the index of the current element in
1802
+ * the input array. If specified, this variable is available within the cond expression.
1560
1803
  */
1561
- as?: string;
1804
+ arrayIndexAs?: string;
1805
+
1806
+ /**
1807
+ * An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as, and the element index with the variable name specified in arrayIndexAs (MongoDB 8.3+).
1808
+ */
1809
+ cond: ResolvesToBool<S>;
1562
1810
 
1563
1811
  /**
1564
1812
  * A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array.
@@ -1575,6 +1823,7 @@ export namespace Aggregation.Expression {
1575
1823
  export interface $first<S> {
1576
1824
  /**
1577
1825
  * Returns the result of an expression for the first document in an array.
1826
+ * New in MongoDB 4.4.
1578
1827
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/}
1579
1828
  */
1580
1829
  $first: ResolvesToArray<S>;
@@ -1587,6 +1836,7 @@ export namespace Aggregation.Expression {
1587
1836
  export interface $firstN<S> {
1588
1837
  /**
1589
1838
  * Returns a specified number of elements from the beginning of an array.
1839
+ * New in MongoDB 5.1.
1590
1840
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN-array-element/}
1591
1841
  */
1592
1842
  $firstN: {
@@ -1609,6 +1859,7 @@ export namespace Aggregation.Expression {
1609
1859
  export interface $floor<S> {
1610
1860
  /**
1611
1861
  * Returns the largest integer less than or equal to the specified number.
1862
+ * New in MongoDB 3.2.
1612
1863
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/floor/}
1613
1864
  */
1614
1865
  $floor: ResolvesToNumber<S>;
@@ -1671,6 +1922,7 @@ export namespace Aggregation.Expression {
1671
1922
  export interface $gt<S> {
1672
1923
  /**
1673
1924
  * Returns true if the first value is greater than the second.
1925
+ * New in MongoDB 2.6.
1674
1926
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/gt/}
1675
1927
  */
1676
1928
  $gt: [expression1: Expression<S>, expression2: Expression<S>];
@@ -1683,11 +1935,48 @@ export namespace Aggregation.Expression {
1683
1935
  export interface $gte<S> {
1684
1936
  /**
1685
1937
  * Returns true if the first value is greater than or equal to the second.
1938
+ * New in MongoDB 2.6.
1686
1939
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/gte/}
1687
1940
  */
1688
1941
  $gte: [expression1: Expression<S>, expression2: Expression<S>];
1689
1942
  }
1690
1943
 
1944
+ /**
1945
+ * A type describing the `$hash` operator.
1946
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hash/}
1947
+ */
1948
+ export interface $hash<S> {
1949
+ /**
1950
+ * Generates and returns a binary hash value (BinData) from a UTF-8 string or binary data. Use $hash in an aggregation
1951
+ * pipeline to compute binary hashes for storage, verification, or comparison. To get a hexadecimal string instead of
1952
+ * binary data, use $hexHash.
1953
+ * New in MongoDB 8.3.
1954
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hash/}
1955
+ */
1956
+ $hash: {
1957
+ input: ResolvesToString<S> | ResolvesToBinData<S> | ResolvesToNull<S>;
1958
+ algorithm: string;
1959
+ };
1960
+ }
1961
+
1962
+ /**
1963
+ * A type describing the `$hexHash` operator.
1964
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hexHash/}
1965
+ */
1966
+ export interface $hexHash<S> {
1967
+ /**
1968
+ * Generates and returns an uppercase hexadecimal string representation of a hash value from a UTF-8 string or binary
1969
+ * data. Use $hexHash in an aggregation pipeline to compute hex-encoded hashes for storage, verification, or comparison.
1970
+ * To get binary data instead of a hexadecimal string, use $hash.
1971
+ * New in MongoDB 8.3.
1972
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hexHash/}
1973
+ */
1974
+ $hexHash: {
1975
+ input: ResolvesToString<S> | ResolvesToBinData<S> | ResolvesToNull<S>;
1976
+ algorithm: string;
1977
+ };
1978
+ }
1979
+
1691
1980
  /**
1692
1981
  * A type describing the `$hour` operator.
1693
1982
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/}
@@ -1695,6 +1984,7 @@ export namespace Aggregation.Expression {
1695
1984
  export interface $hour<S> {
1696
1985
  /**
1697
1986
  * Returns the hour for a date as a number between 0 and 23.
1987
+ * New in MongoDB 2.6.
1698
1988
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/}
1699
1989
  */
1700
1990
  $hour: {
@@ -1717,6 +2007,7 @@ export namespace Aggregation.Expression {
1717
2007
  export interface $ifNull<S> {
1718
2008
  /**
1719
2009
  * 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.
2010
+ * New in MongoDB 3.0.
1720
2011
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/ifNull/}
1721
2012
  */
1722
2013
  $ifNull: [...Expression<S>[]];
@@ -1729,6 +2020,7 @@ export namespace Aggregation.Expression {
1729
2020
  export interface $in<S> {
1730
2021
  /**
1731
2022
  * Returns a boolean indicating whether a specified value is in an array.
2023
+ * New in MongoDB 3.4.
1732
2024
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/in/}
1733
2025
  */
1734
2026
  $in: [
@@ -1751,6 +2043,7 @@ export namespace Aggregation.Expression {
1751
2043
  export interface $indexOfArray<S> {
1752
2044
  /**
1753
2045
  * Searches an array for an occurrence of a specified value and returns the array index of the first occurrence. Array indexes start at zero.
2046
+ * New in MongoDB 3.4.
1754
2047
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfArray/}
1755
2048
  */
1756
2049
  $indexOfArray: [
@@ -1783,6 +2076,7 @@ export namespace Aggregation.Expression {
1783
2076
  export interface $indexOfBytes<S> {
1784
2077
  /**
1785
2078
  * 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.
2079
+ * New in MongoDB 3.4.
1786
2080
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfBytes/}
1787
2081
  */
1788
2082
  $indexOfBytes: [
@@ -1819,6 +2113,7 @@ export namespace Aggregation.Expression {
1819
2113
  export interface $indexOfCP<S> {
1820
2114
  /**
1821
2115
  * 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
2116
+ * New in MongoDB 3.4.
1822
2117
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfCP/}
1823
2118
  */
1824
2119
  $indexOfCP: [
@@ -1855,6 +2150,7 @@ export namespace Aggregation.Expression {
1855
2150
  export interface $isArray<S> {
1856
2151
  /**
1857
2152
  * Determines if the operand is an array. Returns a boolean.
2153
+ * New in MongoDB 4.4.
1858
2154
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isArray/}
1859
2155
  */
1860
2156
  $isArray: [expression: Expression<S>];
@@ -1881,6 +2177,7 @@ export namespace Aggregation.Expression {
1881
2177
  export interface $isoDayOfWeek<S> {
1882
2178
  /**
1883
2179
  * Returns the weekday number in ISO 8601 format, ranging from 1 (for Monday) to 7 (for Sunday).
2180
+ * New in MongoDB 3.4.
1884
2181
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoDayOfWeek/}
1885
2182
  */
1886
2183
  $isoDayOfWeek: {
@@ -1903,6 +2200,7 @@ export namespace Aggregation.Expression {
1903
2200
  export interface $isoWeek<S> {
1904
2201
  /**
1905
2202
  * 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.
2203
+ * New in MongoDB 3.4.
1906
2204
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeek/}
1907
2205
  */
1908
2206
  $isoWeek: {
@@ -1925,6 +2223,7 @@ export namespace Aggregation.Expression {
1925
2223
  export interface $isoWeekYear<S> {
1926
2224
  /**
1927
2225
  * 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).
2226
+ * New in MongoDB 3.4.
1928
2227
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeekYear/}
1929
2228
  */
1930
2229
  $isoWeekYear: {
@@ -1947,6 +2246,7 @@ export namespace Aggregation.Expression {
1947
2246
  export interface $last<S> {
1948
2247
  /**
1949
2248
  * Returns the result of an expression for the last document in an array.
2249
+ * New in MongoDB 4.4.
1950
2250
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/}
1951
2251
  */
1952
2252
  $last: ResolvesToArray<S>;
@@ -1959,6 +2259,7 @@ export namespace Aggregation.Expression {
1959
2259
  export interface $lastN<S> {
1960
2260
  /**
1961
2261
  * Returns a specified number of elements from the end of an array.
2262
+ * New in MongoDB 5.1.
1962
2263
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#array-operator}
1963
2264
  */
1964
2265
  $lastN: {
@@ -1982,6 +2283,7 @@ export namespace Aggregation.Expression {
1982
2283
  /**
1983
2284
  * Defines variables for use within the scope of a subexpression and returns the result of the subexpression. Accepts named parameters.
1984
2285
  * Accepts any number of argument expressions.
2286
+ * New in MongoDB 3.6.
1985
2287
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/let/}
1986
2288
  */
1987
2289
  $let: {
@@ -2005,6 +2307,7 @@ export namespace Aggregation.Expression {
2005
2307
  export interface $literal<S> {
2006
2308
  /**
2007
2309
  * 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.
2310
+ * New in MongoDB 3.0.
2008
2311
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/literal/}
2009
2312
  */
2010
2313
  $literal: any;
@@ -2018,6 +2321,7 @@ export namespace Aggregation.Expression {
2018
2321
  /**
2019
2322
  * Calculates the natural log of a number.
2020
2323
  * $ln is equivalent to $log: [ <number>, Math.E ] expression, where Math.E is a JavaScript representation for Euler's number e.
2324
+ * New in MongoDB 4.2.
2021
2325
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/ln/}
2022
2326
  */
2023
2327
  $ln: ResolvesToNumber<S>;
@@ -2030,6 +2334,7 @@ export namespace Aggregation.Expression {
2030
2334
  export interface $log<S> {
2031
2335
  /**
2032
2336
  * Calculates the log of a number in the specified base.
2337
+ * New in MongoDB 4.2.
2033
2338
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/log/}
2034
2339
  */
2035
2340
  $log: [
@@ -2052,6 +2357,7 @@ export namespace Aggregation.Expression {
2052
2357
  export interface $log10<S> {
2053
2358
  /**
2054
2359
  * Calculates the log base 10 of a number.
2360
+ * New in MongoDB 4.2.
2055
2361
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/log10/}
2056
2362
  */
2057
2363
  $log10: ResolvesToNumber<S>;
@@ -2064,6 +2370,7 @@ export namespace Aggregation.Expression {
2064
2370
  export interface $lt<S> {
2065
2371
  /**
2066
2372
  * Returns true if the first value is less than the second.
2373
+ * New in MongoDB 2.6.
2067
2374
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lt/}
2068
2375
  */
2069
2376
  $lt: [expression1: Expression<S>, expression2: Expression<S>];
@@ -2076,6 +2383,7 @@ export namespace Aggregation.Expression {
2076
2383
  export interface $lte<S> {
2077
2384
  /**
2078
2385
  * Returns true if the first value is less than or equal to the second.
2386
+ * New in MongoDB 2.6.
2079
2387
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lte/}
2080
2388
  */
2081
2389
  $lte: [expression1: Expression<S>, expression2: Expression<S>];
@@ -2113,6 +2421,7 @@ export namespace Aggregation.Expression {
2113
2421
  export interface $map<S> {
2114
2422
  /**
2115
2423
  * Applies a subexpression to each element of an array and returns the array of resulting values in order. Accepts named parameters.
2424
+ * New in MongoDB 3.2.
2116
2425
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/}
2117
2426
  */
2118
2427
  $map: {
@@ -2124,7 +2433,13 @@ export namespace Aggregation.Expression {
2124
2433
  /**
2125
2434
  * 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
2435
  */
2127
- as?: ResolvesToString<S>;
2436
+ as?: string;
2437
+
2438
+ /**
2439
+ * A name for the variable that represents the index of the current element in
2440
+ * the input array. If specified, this variable is available within the in expression.
2441
+ */
2442
+ arrayIndexAs?: string;
2128
2443
 
2129
2444
  /**
2130
2445
  * 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 +2456,7 @@ export namespace Aggregation.Expression {
2141
2456
  /**
2142
2457
  * Returns the maximum value that results from applying an expression to each document.
2143
2458
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
2459
+ * New in MongoDB 3.2.
2144
2460
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/}
2145
2461
  */
2146
2462
  $max: [...Expression<S>[]];
@@ -2153,6 +2469,7 @@ export namespace Aggregation.Expression {
2153
2469
  export interface $maxN<S> {
2154
2470
  /**
2155
2471
  * Returns the n largest values in an array. Distinct from the $maxN accumulator.
2472
+ * New in MongoDB 5.1.
2156
2473
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN-array-element/}
2157
2474
  */
2158
2475
  $maxN: {
@@ -2175,18 +2492,18 @@ export namespace Aggregation.Expression {
2175
2492
  export interface $median<S> {
2176
2493
  /**
2177
2494
  * Returns an approximation of the median, the 50th percentile, as a scalar value.
2178
- * New in MongoDB 7.0.
2179
2495
  * This operator is available as an accumulator in these stages:
2180
2496
  * $group
2181
2497
  * $setWindowFields
2182
2498
  * It is also available as an aggregation expression.
2499
+ * New in MongoDB 7.0.
2183
2500
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/}
2184
2501
  */
2185
2502
  $median: {
2186
2503
  /**
2187
2504
  * $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
2505
  */
2189
- input: ResolvesToNumber<S> | ResolvesToNumber<S>[];
2506
+ input: ResolvesToNumber<S> | unknown[];
2190
2507
 
2191
2508
  /**
2192
2509
  * The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'.
@@ -2202,6 +2519,7 @@ export namespace Aggregation.Expression {
2202
2519
  export interface $mergeObjects<S> {
2203
2520
  /**
2204
2521
  * Combines multiple documents into a single document.
2522
+ * New in MongoDB 3.4.
2205
2523
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/}
2206
2524
  */
2207
2525
  $mergeObjects: [
@@ -2219,6 +2537,7 @@ export namespace Aggregation.Expression {
2219
2537
  export interface $meta<S> {
2220
2538
  /**
2221
2539
  * Access available per-document metadata related to the aggregation operation.
2540
+ * New in MongoDB 4.4.
2222
2541
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/meta/}
2223
2542
  */
2224
2543
  $meta: string;
@@ -2231,6 +2550,7 @@ export namespace Aggregation.Expression {
2231
2550
  export interface $millisecond<S> {
2232
2551
  /**
2233
2552
  * Returns the milliseconds of a date as a number between 0 and 999.
2553
+ * New in MongoDB 2.6.
2234
2554
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/millisecond/}
2235
2555
  */
2236
2556
  $millisecond: {
@@ -2254,6 +2574,7 @@ export namespace Aggregation.Expression {
2254
2574
  /**
2255
2575
  * Returns the minimum value that results from applying an expression to each document.
2256
2576
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
2577
+ * New in MongoDB 3.2.
2257
2578
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/}
2258
2579
  */
2259
2580
  $min: [...Expression<S>[]];
@@ -2266,6 +2587,7 @@ export namespace Aggregation.Expression {
2266
2587
  export interface $minN<S> {
2267
2588
  /**
2268
2589
  * Returns the n smallest values in an array. Distinct from the $minN accumulator.
2590
+ * New in MongoDB 5.1.
2269
2591
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN-array-element/}
2270
2592
  */
2271
2593
  $minN: {
@@ -2288,6 +2610,7 @@ export namespace Aggregation.Expression {
2288
2610
  export interface $minute<S> {
2289
2611
  /**
2290
2612
  * Returns the minute for a date as a number between 0 and 59.
2613
+ * New in MongoDB 2.6.
2291
2614
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/minute/}
2292
2615
  */
2293
2616
  $minute: {
@@ -2310,6 +2633,7 @@ export namespace Aggregation.Expression {
2310
2633
  export interface $mod<S> {
2311
2634
  /**
2312
2635
  * Returns the remainder of the first number divided by the second. Accepts two argument expressions.
2636
+ * New in MongoDB 3.2.
2313
2637
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/mod/}
2314
2638
  */
2315
2639
  $mod: [
@@ -2328,6 +2652,7 @@ export namespace Aggregation.Expression {
2328
2652
  export interface $month<S> {
2329
2653
  /**
2330
2654
  * Returns the month for a date as a number between 1 (January) and 12 (December).
2655
+ * New in MongoDB 2.6.
2331
2656
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/month/}
2332
2657
  */
2333
2658
  $month: {
@@ -2350,6 +2675,7 @@ export namespace Aggregation.Expression {
2350
2675
  export interface $multiply<S> {
2351
2676
  /**
2352
2677
  * Multiplies numbers to return the product. Accepts any number of argument expressions.
2678
+ * New in MongoDB 3.2.
2353
2679
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/multiply/}
2354
2680
  */
2355
2681
  $multiply: [
@@ -2368,6 +2694,7 @@ export namespace Aggregation.Expression {
2368
2694
  export interface $ne<S> {
2369
2695
  /**
2370
2696
  * Returns true if the values are not equivalent.
2697
+ * New in MongoDB 2.6.
2371
2698
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/ne/}
2372
2699
  */
2373
2700
  $ne: [expression1: Expression<S>, expression2: Expression<S>];
@@ -2380,6 +2707,7 @@ export namespace Aggregation.Expression {
2380
2707
  export interface $not<S> {
2381
2708
  /**
2382
2709
  * Returns the boolean value that is the opposite of its argument expression. Accepts a single argument expression.
2710
+ * New in MongoDB 2.6.
2383
2711
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/not/}
2384
2712
  */
2385
2713
  $not: [expression: Expression<S> | ResolvesToBool<S>];
@@ -2392,6 +2720,7 @@ export namespace Aggregation.Expression {
2392
2720
  export interface $objectToArray<S> {
2393
2721
  /**
2394
2722
  * Converts a document to an array of documents representing key-value pairs.
2723
+ * New in MongoDB 3.4.
2395
2724
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/objectToArray/}
2396
2725
  */
2397
2726
  $objectToArray: ResolvesToObject<S>;
@@ -2404,6 +2733,7 @@ export namespace Aggregation.Expression {
2404
2733
  export interface $or<S> {
2405
2734
  /**
2406
2735
  * Returns true when any of its expressions evaluates to true. Accepts any number of argument expressions.
2736
+ * New in MongoDB 2.6.
2407
2737
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/or/}
2408
2738
  */
2409
2739
  $or: [...(Expression<S> | ResolvesToBool<S>)[]];
@@ -2416,18 +2746,18 @@ export namespace Aggregation.Expression {
2416
2746
  export interface $percentile<S> {
2417
2747
  /**
2418
2748
  * Returns an array of scalar values that correspond to specified percentile values.
2419
- * New in MongoDB 7.0.
2420
2749
  * This operator is available as an accumulator in these stages:
2421
2750
  * $group
2422
2751
  * $setWindowFields
2423
2752
  * It is also available as an aggregation expression.
2753
+ * New in MongoDB 7.0.
2424
2754
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/}
2425
2755
  */
2426
2756
  $percentile: {
2427
2757
  /**
2428
2758
  * $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
2759
  */
2430
- input: ResolvesToNumber<S> | ResolvesToNumber<S>[];
2760
+ input: ResolvesToNumber<S> | unknown[];
2431
2761
 
2432
2762
  /**
2433
2763
  * $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 +2779,7 @@ export namespace Aggregation.Expression {
2449
2779
  export interface $pow<S> {
2450
2780
  /**
2451
2781
  * Raises a number to the specified exponent.
2782
+ * New in MongoDB 3.2.
2452
2783
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/pow/}
2453
2784
  */
2454
2785
  $pow: [number: ResolvesToNumber<S>, exponent: ResolvesToNumber<S>];
@@ -2461,6 +2792,7 @@ export namespace Aggregation.Expression {
2461
2792
  export interface $radiansToDegrees<S> {
2462
2793
  /**
2463
2794
  * Converts a value from radians to degrees.
2795
+ * New in MongoDB 4.2.
2464
2796
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/radiansToDegrees/}
2465
2797
  */
2466
2798
  $radiansToDegrees: ResolvesToNumber<S>;
@@ -2473,6 +2805,7 @@ export namespace Aggregation.Expression {
2473
2805
  export interface $rand<S> {
2474
2806
  /**
2475
2807
  * Returns a random float between 0 and 1
2808
+ * New in MongoDB 4.4.
2476
2809
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rand/}
2477
2810
  */
2478
2811
  $rand: Record<string, never>;
@@ -2485,6 +2818,7 @@ export namespace Aggregation.Expression {
2485
2818
  export interface $range<S> {
2486
2819
  /**
2487
2820
  * Outputs an array containing a sequence of integers according to user-defined inputs.
2821
+ * New in MongoDB 3.4.
2488
2822
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/range/}
2489
2823
  */
2490
2824
  $range: [
@@ -2512,6 +2846,7 @@ export namespace Aggregation.Expression {
2512
2846
  export interface $reduce<S> {
2513
2847
  /**
2514
2848
  * Applies an expression to each element in an array and combines them into a single value.
2849
+ * New in MongoDB 3.4.
2515
2850
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/}
2516
2851
  */
2517
2852
  $reduce: {
@@ -2530,19 +2865,19 @@ export namespace Aggregation.Expression {
2530
2865
  /**
2531
2866
  * A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left.
2532
2867
  * During evaluation of the in expression, two variables will be available:
2533
- * - value is the variable that represents the cumulative value of the expression.
2534
- * - this is the variable that refers to the element being processed.
2868
+ * - value is the variable that represents the cumulative value of the expression. Use valueAs (MongoDB 8.3+) to specify a custom name.
2869
+ * - this is the variable that refers to the element being processed. Use as (MongoDB 8.3+) to specify a custom name.
2535
2870
  */
2536
2871
  in:
2537
2872
  | Expression<
2538
2873
  S & {
2539
2874
  /**
2540
- * The variable that represents the cumulative value of the expression.
2875
+ * The variable that refers to the element being processed. Renamed via the as argument (MongoDB 8.3+).
2541
2876
  */
2542
2877
  $this: any;
2543
2878
 
2544
2879
  /**
2545
- * The variable that refers to the element being processed.
2880
+ * The variable that represents the cumulative value of the expression. Renamed via the valueAs argument (MongoDB 8.3+).
2546
2881
  */
2547
2882
  $value: any;
2548
2883
  }
@@ -2550,16 +2885,34 @@ export namespace Aggregation.Expression {
2550
2885
  | ExpressionMap<
2551
2886
  S & {
2552
2887
  /**
2553
- * The variable that represents the cumulative value of the expression.
2888
+ * The variable that refers to the element being processed. Renamed via the as argument (MongoDB 8.3+).
2554
2889
  */
2555
2890
  $this: any;
2556
2891
 
2557
2892
  /**
2558
- * The variable that refers to the element being processed.
2893
+ * The variable that represents the cumulative value of the expression. Renamed via the valueAs argument (MongoDB 8.3+).
2559
2894
  */
2560
2895
  $value: any;
2561
2896
  }
2562
2897
  >;
2898
+
2899
+ /**
2900
+ * A name for the variable that represents each individual element of the input array.
2901
+ * If no name is specified, the variable name defaults to this.
2902
+ */
2903
+ as?: string;
2904
+
2905
+ /**
2906
+ * A name for the variable that represents the cumulative value of the expression.
2907
+ * If no name is specified, the variable name defaults to value.
2908
+ */
2909
+ valueAs?: string;
2910
+
2911
+ /**
2912
+ * A name for the variable that represents the index of the current element in
2913
+ * the input array. If specified, this variable is available within the in expression.
2914
+ */
2915
+ arrayIndexAs?: string;
2563
2916
  };
2564
2917
  }
2565
2918
 
@@ -2655,7 +3008,7 @@ export namespace Aggregation.Expression {
2655
3008
  /**
2656
3009
  * 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
3010
  */
2658
- find: ResolvesToString<S> | ResolvesToNull<S>;
3011
+ find: ResolvesToString<S> | ResolvesToNull<S> | ResolvesToRegex<S>;
2659
3012
 
2660
3013
  /**
2661
3014
  * 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 +3029,17 @@ export namespace Aggregation.Expression {
2676
3029
  */
2677
3030
  $replaceOne: {
2678
3031
  /**
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.
3032
+ * 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
3033
  */
2681
3034
  input: ResolvesToString<S> | ResolvesToNull<S>;
2682
3035
 
2683
3036
  /**
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.
3037
+ * 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
3038
  */
2686
- find: ResolvesToString<S> | ResolvesToNull<S>;
3039
+ find: ResolvesToString<S> | ResolvesToNull<S> | ResolvesToRegex<S>;
2687
3040
 
2688
3041
  /**
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.
3042
+ * 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
3043
  */
2691
3044
  replacement: ResolvesToString<S> | ResolvesToNull<S>;
2692
3045
  };
@@ -2699,6 +3052,7 @@ export namespace Aggregation.Expression {
2699
3052
  export interface $reverseArray<S> {
2700
3053
  /**
2701
3054
  * Returns an array with the elements in reverse order.
3055
+ * New in MongoDB 3.2.
2702
3056
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/reverseArray/}
2703
3057
  */
2704
3058
  $reverseArray: ResolvesToArray<S>;
@@ -2711,6 +3065,7 @@ export namespace Aggregation.Expression {
2711
3065
  export interface $round<S> {
2712
3066
  /**
2713
3067
  * Rounds a number to a whole integer or to a specified decimal place.
3068
+ * New in MongoDB 3.2.
2714
3069
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/round/}
2715
3070
  */
2716
3071
  $round: [
@@ -2734,6 +3089,7 @@ export namespace Aggregation.Expression {
2734
3089
  export interface $rtrim<S> {
2735
3090
  /**
2736
3091
  * Removes whitespace characters, including null, or the specified characters from the end of a string.
3092
+ * New in MongoDB 4.0.
2737
3093
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rtrim/}
2738
3094
  */
2739
3095
  $rtrim: {
@@ -2758,6 +3114,7 @@ export namespace Aggregation.Expression {
2758
3114
  export interface $second<S> {
2759
3115
  /**
2760
3116
  * Returns the seconds for a date as a number between 0 and 60 (leap seconds).
3117
+ * New in MongoDB 2.6.
2761
3118
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/second/}
2762
3119
  */
2763
3120
  $second: {
@@ -2773,6 +3130,40 @@ export namespace Aggregation.Expression {
2773
3130
  };
2774
3131
  }
2775
3132
 
3133
+ /**
3134
+ * A type describing the `$serializeEJSON` operator.
3135
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/serializeEJSON/}
3136
+ */
3137
+ export interface $serializeEJSON<S> {
3138
+ /**
3139
+ * Converts BSON values to Extended JSON (EJSON) format. The result is a
3140
+ * BSON document with EJSON type wrappers that can then be converted to
3141
+ * a JSON string using $toString.
3142
+ * New in MongoDB 8.3.
3143
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/serializeEJSON/}
3144
+ */
3145
+ $serializeEJSON: {
3146
+ /**
3147
+ * The BSON value to convert to Extended JSON format.
3148
+ */
3149
+ input: Expression<S>;
3150
+
3151
+ /**
3152
+ * Specifies whether to use Relaxed Extended JSON format. If true, numeric types
3153
+ * (Int32, Int64, Double) are represented as native JSON numbers for better readability.
3154
+ * If false or unspecified, uses Canonical Extended JSON format which preserves type
3155
+ * information for all BSON types. Defaults to false.
3156
+ */
3157
+ relaxed?: ResolvesToBool<S>;
3158
+
3159
+ /**
3160
+ * The value to return if the operation encounters an error during conversion.
3161
+ * If unspecified, the operation throws an error and stops.
3162
+ */
3163
+ onError?: Expression<S>;
3164
+ };
3165
+ }
3166
+
2776
3167
  /**
2777
3168
  * A type describing the `$setDifference` operator.
2778
3169
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/}
@@ -2780,6 +3171,7 @@ export namespace Aggregation.Expression {
2780
3171
  export interface $setDifference<S> {
2781
3172
  /**
2782
3173
  * 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.
3174
+ * New in MongoDB 3.0.
2783
3175
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/}
2784
3176
  */
2785
3177
  $setDifference: [
@@ -2802,6 +3194,7 @@ export namespace Aggregation.Expression {
2802
3194
  export interface $setEquals<S> {
2803
3195
  /**
2804
3196
  * Returns true if the input sets have the same distinct elements. Accepts two or more argument expressions.
3197
+ * New in MongoDB 3.0.
2805
3198
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setEquals/}
2806
3199
  */
2807
3200
  $setEquals: [...ResolvesToArray<S>[]];
@@ -2843,6 +3236,7 @@ export namespace Aggregation.Expression {
2843
3236
  export interface $setIntersection<S> {
2844
3237
  /**
2845
3238
  * Returns a set with elements that appear in all of the input sets. Accepts any number of argument expressions.
3239
+ * New in MongoDB 3.0.
2846
3240
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIntersection/}
2847
3241
  */
2848
3242
  $setIntersection: [...ResolvesToArray<S>[]];
@@ -2855,6 +3249,7 @@ export namespace Aggregation.Expression {
2855
3249
  export interface $setIsSubset<S> {
2856
3250
  /**
2857
3251
  * 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.
3252
+ * New in MongoDB 3.0.
2858
3253
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIsSubset/}
2859
3254
  */
2860
3255
  $setIsSubset: [
@@ -2870,54 +3265,147 @@ export namespace Aggregation.Expression {
2870
3265
  export interface $setUnion<S> {
2871
3266
  /**
2872
3267
  * Returns a set with elements that appear in any of the input sets.
3268
+ * New in MongoDB 3.0.
2873
3269
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/}
2874
3270
  */
2875
3271
  $setUnion: [...ResolvesToArray<S>[]];
2876
3272
  }
2877
3273
 
2878
3274
  /**
2879
- * A type describing the `$sin` operator.
2880
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/}
3275
+ * A type describing the `$sigmoid` operator.
3276
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sigmoid/}
2881
3277
  */
2882
- export interface $sin<S> {
3278
+ export interface $sigmoid<S> {
2883
3279
  /**
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/}
3280
+ * Returns the sigmoid of a value, defined as 1 / (1 + e^(-x)). The result is a value between 0 and 1.
3281
+ * New in MongoDB 8.1.
3282
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sigmoid/}
2886
3283
  */
2887
- $sin: ResolvesToNumber<S>;
3284
+ $sigmoid: ResolvesToNumber<S>;
2888
3285
  }
2889
3286
 
2890
3287
  /**
2891
- * A type describing the `$sinh` operator.
2892
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/}
3288
+ * A type describing the `$similarityCosine` operator.
3289
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityCosine/}
2893
3290
  */
2894
- export interface $sinh<S> {
3291
+ export interface $similarityCosine<S> {
2895
3292
  /**
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/}
3293
+ * Returns the cosine similarity between two vectors. If the score argument is true, the result
3294
+ * is normalized to a value between 0 and 1 for use as a vector search score.
3295
+ * New in MongoDB 8.3.
3296
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityCosine/}
2898
3297
  */
2899
- $sinh: ResolvesToNumber<S>;
3298
+ $similarityCosine: {
3299
+ /**
3300
+ * An array of exactly two expressions that each resolve to an array of numbers.
3301
+ * Both arrays must have the same length.
3302
+ */
3303
+ vectors: ResolvesToArray<S>;
3304
+
3305
+ /**
3306
+ * If true, normalizes the result to a value between 0 and 1 for use as a vector search score. Defaults to false.
3307
+ */
3308
+ score?: boolean;
3309
+ };
2900
3310
  }
2901
3311
 
2902
3312
  /**
2903
- * A type describing the `$size` operator.
2904
- * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/}
3313
+ * A type describing the `$similarityDotProduct` operator.
3314
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityDotProduct/}
2905
3315
  */
2906
- export interface $size<S> {
3316
+ export interface $similarityDotProduct<S> {
2907
3317
  /**
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/}
3318
+ * Returns the dot product similarity between two vectors. If the score argument is true, the result
3319
+ * is normalized to a value between 0 and 1 for use as a vector search score.
3320
+ * New in MongoDB 8.3.
3321
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityDotProduct/}
2910
3322
  */
2911
- $size: ResolvesToArray<S>;
2912
- }
3323
+ $similarityDotProduct: {
3324
+ /**
3325
+ * An array of exactly two expressions that each resolve to an array of numbers.
3326
+ * Both arrays must have the same length.
3327
+ */
3328
+ vectors: ResolvesToArray<S>;
2913
3329
 
2914
- /**
3330
+ /**
3331
+ * If true, normalizes the result to a value between 0 and 1 for use as a vector search score. Defaults to false.
3332
+ */
3333
+ score?: boolean;
3334
+ };
3335
+ }
3336
+
3337
+ /**
3338
+ * A type describing the `$similarityEuclidean` operator.
3339
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityEuclidean/}
3340
+ */
3341
+ export interface $similarityEuclidean<S> {
3342
+ /**
3343
+ * Returns the Euclidean similarity between two vectors. If the score argument is true, the result
3344
+ * is normalized to a value between 0 and 1 for use as a vector search score.
3345
+ * New in MongoDB 8.3.
3346
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/similarityEuclidean/}
3347
+ */
3348
+ $similarityEuclidean: {
3349
+ /**
3350
+ * An array of exactly two expressions that each resolve to an array of numbers.
3351
+ * Both arrays must have the same length.
3352
+ */
3353
+ vectors: ResolvesToArray<S>;
3354
+
3355
+ /**
3356
+ * If true, normalizes the result to a value between 0 and 1 for use as a vector search score. Defaults to false.
3357
+ */
3358
+ score?: boolean;
3359
+ };
3360
+ }
3361
+
3362
+ /**
3363
+ * A type describing the `$sin` operator.
3364
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/}
3365
+ */
3366
+ export interface $sin<S> {
3367
+ /**
3368
+ * Returns the sine of a value that is measured in radians.
3369
+ * New in MongoDB 4.2.
3370
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/}
3371
+ */
3372
+ $sin: ResolvesToNumber<S>;
3373
+ }
3374
+
3375
+ /**
3376
+ * A type describing the `$sinh` operator.
3377
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/}
3378
+ */
3379
+ export interface $sinh<S> {
3380
+ /**
3381
+ * Returns the hyperbolic sine of a value that is measured in radians.
3382
+ * New in MongoDB 4.2.
3383
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/}
3384
+ */
3385
+ $sinh: ResolvesToNumber<S>;
3386
+ }
3387
+
3388
+ /**
3389
+ * A type describing the `$size` operator.
3390
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/}
3391
+ */
3392
+ export interface $size<S> {
3393
+ /**
3394
+ * Returns the number of elements in the array. Accepts a single expression as argument.
3395
+ * New in MongoDB 3.2.
3396
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/}
3397
+ */
3398
+ $size: ResolvesToArray<S>;
3399
+ }
3400
+
3401
+ /**
2915
3402
  * A type describing the `$slice` operator.
2916
3403
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/}
2917
3404
  */
2918
3405
  export interface $slice<S> {
2919
3406
  /**
2920
3407
  * Returns a subset of an array.
3408
+ * New in MongoDB 3.2.
2921
3409
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/}
2922
3410
  */
2923
3411
  $slice:
@@ -2963,6 +3451,7 @@ export namespace Aggregation.Expression {
2963
3451
  export interface $sortArray<S> {
2964
3452
  /**
2965
3453
  * Sorts the elements of an array.
3454
+ * New in MongoDB 5.2.
2966
3455
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/}
2967
3456
  */
2968
3457
  $sortArray: {
@@ -2987,6 +3476,7 @@ export namespace Aggregation.Expression {
2987
3476
  export interface $split<S> {
2988
3477
  /**
2989
3478
  * 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.
3479
+ * New in MongoDB 3.4.
2990
3480
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/split/}
2991
3481
  */
2992
3482
  $split: [
@@ -2996,9 +3486,9 @@ export namespace Aggregation.Expression {
2996
3486
  string: ResolvesToString<S>,
2997
3487
 
2998
3488
  /**
2999
- * The delimiter to use when splitting the string expression. delimiter can be any valid expression as long as it resolves to a string.
3489
+ * 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
3490
  */
3001
- delimiter: ResolvesToString<S>,
3491
+ delimiter: ResolvesToString<S> | ResolvesToRegex<S>,
3002
3492
  ];
3003
3493
  }
3004
3494
 
@@ -3009,6 +3499,7 @@ export namespace Aggregation.Expression {
3009
3499
  export interface $sqrt<S> {
3010
3500
  /**
3011
3501
  * Calculates the square root.
3502
+ * New in MongoDB 3.2.
3012
3503
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sqrt/}
3013
3504
  */
3014
3505
  $sqrt: ResolvesToNumber<S>;
@@ -3023,6 +3514,7 @@ export namespace Aggregation.Expression {
3023
3514
  * 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
3515
  * If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead.
3025
3516
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
3517
+ * New in MongoDB 5.0.
3026
3518
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/}
3027
3519
  */
3028
3520
  $stdDevPop: [...ResolvesToNumber<S>[]];
@@ -3036,6 +3528,7 @@ export namespace Aggregation.Expression {
3036
3528
  /**
3037
3529
  * 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
3530
  * If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead.
3531
+ * New in MongoDB 5.0.
3039
3532
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/}
3040
3533
  */
3041
3534
  $stdDevSamp: [...ResolvesToNumber<S>[]];
@@ -3048,6 +3541,7 @@ export namespace Aggregation.Expression {
3048
3541
  export interface $strLenBytes<S> {
3049
3542
  /**
3050
3543
  * Returns the number of UTF-8 encoded bytes in a string.
3544
+ * New in MongoDB 3.0.
3051
3545
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenBytes/}
3052
3546
  */
3053
3547
  $strLenBytes: ResolvesToString<S>;
@@ -3060,6 +3554,7 @@ export namespace Aggregation.Expression {
3060
3554
  export interface $strLenCP<S> {
3061
3555
  /**
3062
3556
  * Returns the number of UTF-8 code points in a string.
3557
+ * New in MongoDB 3.0.
3063
3558
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenCP/}
3064
3559
  */
3065
3560
  $strLenCP: ResolvesToString<S>;
@@ -3072,6 +3567,7 @@ export namespace Aggregation.Expression {
3072
3567
  export interface $strcasecmp<S> {
3073
3568
  /**
3074
3569
  * 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.
3570
+ * New in MongoDB 3.0.
3075
3571
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/strcasecmp/}
3076
3572
  */
3077
3573
  $strcasecmp: [
@@ -3087,6 +3583,7 @@ export namespace Aggregation.Expression {
3087
3583
  export interface $substr<S> {
3088
3584
  /**
3089
3585
  * Deprecated. Use $substrBytes or $substrCP.
3586
+ * New in MongoDB 3.0.
3090
3587
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/substr/}
3091
3588
  */
3092
3589
  $substr: [
@@ -3111,6 +3608,7 @@ export namespace Aggregation.Expression {
3111
3608
  export interface $substrBytes<S> {
3112
3609
  /**
3113
3610
  * 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.
3611
+ * New in MongoDB 3.0.
3114
3612
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrBytes/}
3115
3613
  */
3116
3614
  $substrBytes: [
@@ -3135,6 +3633,7 @@ export namespace Aggregation.Expression {
3135
3633
  export interface $substrCP<S> {
3136
3634
  /**
3137
3635
  * 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.
3636
+ * New in MongoDB 3.0.
3138
3637
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrCP/}
3139
3638
  */
3140
3639
  $substrCP: [
@@ -3159,6 +3658,7 @@ export namespace Aggregation.Expression {
3159
3658
  export interface $subtract<S> {
3160
3659
  /**
3161
3660
  * 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.
3661
+ * New in MongoDB 2.6.
3162
3662
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/}
3163
3663
  */
3164
3664
  $subtract: [
@@ -3167,6 +3667,20 @@ export namespace Aggregation.Expression {
3167
3667
  ];
3168
3668
  }
3169
3669
 
3670
+ /**
3671
+ * A type describing the `$subtype` operator.
3672
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtype/}
3673
+ */
3674
+ export interface $subtype<S> {
3675
+ /**
3676
+ * Returns the subtype of a given value as an integer. In MongoDB 8.3, the only expression
3677
+ * that contains a subtype is a BinData expression.
3678
+ * New in MongoDB 8.3.
3679
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtype/}
3680
+ */
3681
+ $subtype: ResolvesToBinData<S>;
3682
+ }
3683
+
3170
3684
  /**
3171
3685
  * A type describing the `$sum` operator.
3172
3686
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/}
@@ -3175,6 +3689,7 @@ export namespace Aggregation.Expression {
3175
3689
  /**
3176
3690
  * Returns a sum of numerical values. Ignores non-numeric values.
3177
3691
  * Changed in MongoDB 5.0: Available in the $setWindowFields stage.
3692
+ * New in MongoDB 3.2.
3178
3693
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/}
3179
3694
  */
3180
3695
  $sum: [...(ResolvesToNumber<S> | ResolvesToArray<S>)[]];
@@ -3187,6 +3702,7 @@ export namespace Aggregation.Expression {
3187
3702
  export interface $switch<S> {
3188
3703
  /**
3189
3704
  * 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.
3705
+ * New in MongoDB 4.0.
3190
3706
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/}
3191
3707
  */
3192
3708
  $switch: {
@@ -3213,6 +3729,7 @@ export namespace Aggregation.Expression {
3213
3729
  export interface $tan<S> {
3214
3730
  /**
3215
3731
  * Returns the tangent of a value that is measured in radians.
3732
+ * New in MongoDB 4.2.
3216
3733
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/tan/}
3217
3734
  */
3218
3735
  $tan: ResolvesToNumber<S>;
@@ -3225,11 +3742,26 @@ export namespace Aggregation.Expression {
3225
3742
  export interface $tanh<S> {
3226
3743
  /**
3227
3744
  * Returns the hyperbolic tangent of a value that is measured in radians.
3745
+ * New in MongoDB 4.2.
3228
3746
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/tanh/}
3229
3747
  */
3230
3748
  $tanh: ResolvesToNumber<S>;
3231
3749
  }
3232
3750
 
3751
+ /**
3752
+ * A type describing the `$toArray` operator.
3753
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toArray/}
3754
+ */
3755
+ export interface $toArray<S> {
3756
+ /**
3757
+ * Converts a value to an array. If the value cannot be converted, $toArray errors.
3758
+ * If the value is null or missing, $toArray returns null.
3759
+ * New in MongoDB 8.3.
3760
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toArray/}
3761
+ */
3762
+ $toArray: Expression<S>;
3763
+ }
3764
+
3233
3765
  /**
3234
3766
  * A type describing the `$toBool` operator.
3235
3767
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toBool/}
@@ -3289,6 +3821,7 @@ export namespace Aggregation.Expression {
3289
3821
  export interface $toHashedIndexKey<S> {
3290
3822
  /**
3291
3823
  * 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.
3824
+ * New in MongoDB 4.4.
3292
3825
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/}
3293
3826
  */
3294
3827
  $toHashedIndexKey: Expression<S>;
@@ -3327,11 +3860,26 @@ export namespace Aggregation.Expression {
3327
3860
  export interface $toLower<S> {
3328
3861
  /**
3329
3862
  * Converts a string to lowercase. Accepts a single argument expression.
3863
+ * New in MongoDB 3.0.
3330
3864
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLower/}
3331
3865
  */
3332
3866
  $toLower: ResolvesToString<S>;
3333
3867
  }
3334
3868
 
3869
+ /**
3870
+ * A type describing the `$toObject` operator.
3871
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObject/}
3872
+ */
3873
+ export interface $toObject<S> {
3874
+ /**
3875
+ * Converts a string to an object. If the value cannot be converted, $toObject errors.
3876
+ * If the value is null or missing, $toObject returns null.
3877
+ * New in MongoDB 8.3.
3878
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObject/}
3879
+ */
3880
+ $toObject: Expression<S>;
3881
+ }
3882
+
3335
3883
  /**
3336
3884
  * A type describing the `$toObjectId` operator.
3337
3885
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObjectId/}
@@ -3365,11 +3913,74 @@ export namespace Aggregation.Expression {
3365
3913
  export interface $toUpper<S> {
3366
3914
  /**
3367
3915
  * Converts a string to uppercase. Accepts a single argument expression.
3916
+ * New in MongoDB 3.0.
3368
3917
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/toUpper/}
3369
3918
  */
3370
3919
  $toUpper: ResolvesToString<S>;
3371
3920
  }
3372
3921
 
3922
+ /**
3923
+ * A type describing the `$top` operator.
3924
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/top-array-operator/}
3925
+ */
3926
+ export interface $top<S> {
3927
+ /**
3928
+ * Returns the top element within an array according to the specified sort order.
3929
+ * New in MongoDB 7.0.
3930
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/top-array-operator/}
3931
+ */
3932
+ $top: {
3933
+ /**
3934
+ * Specifies the order of results, with syntax similar to $sort.
3935
+ */
3936
+ sortBy: SortBy;
3937
+
3938
+ /**
3939
+ * Represents the output for each element in the input array and can be any expression.
3940
+ */
3941
+ output: Expression<S>;
3942
+
3943
+ /**
3944
+ * An expression that resolves to the array from which to return the top element.
3945
+ */
3946
+ input: ResolvesToArray<S>;
3947
+ };
3948
+ }
3949
+
3950
+ /**
3951
+ * A type describing the `$topN` operator.
3952
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN-array-operator/}
3953
+ */
3954
+ export interface $topN<S> {
3955
+ /**
3956
+ * Returns an aggregation of the top n elements within an array, according to the specified sort order.
3957
+ * If the array contains fewer than n elements, $topN returns all elements in the array.
3958
+ * New in MongoDB 7.0.
3959
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN-array-operator/}
3960
+ */
3961
+ $topN: {
3962
+ /**
3963
+ * An expression that resolves to a positive integer. The integer specifies the number of array elements that $topN returns.
3964
+ */
3965
+ n: ResolvesToInt<S>;
3966
+
3967
+ /**
3968
+ * Specifies the order of results, with syntax similar to $sort.
3969
+ */
3970
+ sortBy: SortBy;
3971
+
3972
+ /**
3973
+ * Represents the output for each element in the input array and can be any expression.
3974
+ */
3975
+ output: Expression<S>;
3976
+
3977
+ /**
3978
+ * An expression that resolves to the array from which to return the top n elements.
3979
+ */
3980
+ input: ResolvesToArray<S>;
3981
+ };
3982
+ }
3983
+
3373
3984
  /**
3374
3985
  * A type describing the `$trim` operator.
3375
3986
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/trim/}
@@ -3402,6 +4013,7 @@ export namespace Aggregation.Expression {
3402
4013
  export interface $trunc<S> {
3403
4014
  /**
3404
4015
  * Truncates a number to a whole integer or to a specified decimal place.
4016
+ * New in MongoDB 3.2.
3405
4017
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/trunc/}
3406
4018
  */
3407
4019
  $trunc: [
@@ -3451,6 +4063,7 @@ export namespace Aggregation.Expression {
3451
4063
  export interface $type<S> {
3452
4064
  /**
3453
4065
  * Return the BSON data type of the field.
4066
+ * New in MongoDB 3.4.
3454
4067
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/type/}
3455
4068
  */
3456
4069
  $type: Expression<S>;
@@ -3464,6 +4077,7 @@ export namespace Aggregation.Expression {
3464
4077
  /**
3465
4078
  * You can use $unsetField to remove fields with names that contain periods (.) or that start with dollar signs ($).
3466
4079
  * $unsetField is an alias for $setField using $$REMOVE to remove fields.
4080
+ * New in MongoDB 5.0.
3467
4081
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/}
3468
4082
  */
3469
4083
  $unsetField: {
@@ -3486,6 +4100,7 @@ export namespace Aggregation.Expression {
3486
4100
  export interface $week<S> {
3487
4101
  /**
3488
4102
  * 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).
4103
+ * New in MongoDB 2.6.
3489
4104
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/week/}
3490
4105
  */
3491
4106
  $week: {
@@ -3508,6 +4123,7 @@ export namespace Aggregation.Expression {
3508
4123
  export interface $year<S> {
3509
4124
  /**
3510
4125
  * Returns the year for a date as a number (e.g. 2014).
4126
+ * New in MongoDB 2.6.
3511
4127
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/year/}
3512
4128
  */
3513
4129
  $year: {
@@ -3530,6 +4146,7 @@ export namespace Aggregation.Expression {
3530
4146
  export interface $zip<S> {
3531
4147
  /**
3532
4148
  * Merge two arrays together.
4149
+ * New in MongoDB 3.2.
3533
4150
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/zip/}
3534
4151
  */
3535
4152
  $zip: {
@@ -3563,6 +4180,7 @@ export namespace Aggregation.Query {
3563
4180
  export interface $all<S> {
3564
4181
  /**
3565
4182
  * Matches arrays that contain all elements specified in the query.
4183
+ * New in MongoDB 2.0.
3566
4184
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/all/}
3567
4185
  */
3568
4186
  $all: [...FieldQuery<S>[]];
@@ -3587,9 +4205,10 @@ export namespace Aggregation.Query {
3587
4205
  export interface $bitsAllClear<S> {
3588
4206
  /**
3589
4207
  * Matches numeric or binary values in which a set of bit positions all have a value of 0.
4208
+ * New in MongoDB 3.2.
3590
4209
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/}
3591
4210
  */
3592
- $bitsAllClear: (Int | bson.Binary) | (Int | bson.Binary)[];
4211
+ $bitsAllClear: (Int | bson.Binary) | unknown[];
3593
4212
  }
3594
4213
 
3595
4214
  /**
@@ -3599,9 +4218,10 @@ export namespace Aggregation.Query {
3599
4218
  export interface $bitsAllSet<S> {
3600
4219
  /**
3601
4220
  * Matches numeric or binary values in which a set of bit positions all have a value of 1.
4221
+ * New in MongoDB 3.2.
3602
4222
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/}
3603
4223
  */
3604
- $bitsAllSet: (Int | bson.Binary) | (Int | bson.Binary)[];
4224
+ $bitsAllSet: (Int | bson.Binary) | unknown[];
3605
4225
  }
3606
4226
 
3607
4227
  /**
@@ -3611,9 +4231,10 @@ export namespace Aggregation.Query {
3611
4231
  export interface $bitsAnyClear<S> {
3612
4232
  /**
3613
4233
  * Matches numeric or binary values in which any bit from a set of bit positions has a value of 0.
4234
+ * New in MongoDB 3.2.
3614
4235
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/}
3615
4236
  */
3616
- $bitsAnyClear: (Int | bson.Binary) | (Int | bson.Binary)[];
4237
+ $bitsAnyClear: (Int | bson.Binary) | unknown[];
3617
4238
  }
3618
4239
 
3619
4240
  /**
@@ -3623,9 +4244,10 @@ export namespace Aggregation.Query {
3623
4244
  export interface $bitsAnySet<S> {
3624
4245
  /**
3625
4246
  * Matches numeric or binary values in which any bit from a set of bit positions has a value of 1.
4247
+ * New in MongoDB 3.2.
3626
4248
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/}
3627
4249
  */
3628
- $bitsAnySet: (Int | bson.Binary) | (Int | bson.Binary)[];
4250
+ $bitsAnySet: (Int | bson.Binary) | unknown[];
3629
4251
  }
3630
4252
 
3631
4253
  /**
@@ -3635,6 +4257,7 @@ export namespace Aggregation.Query {
3635
4257
  export interface $box<S> {
3636
4258
  /**
3637
4259
  * Specifies a rectangular box using legacy coordinate pairs for $geoWithin queries. The 2d index supports $box.
4260
+ * New in MongoDB 2.4.
3638
4261
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/box/}
3639
4262
  */
3640
4263
  $box: unknown[];
@@ -3647,6 +4270,7 @@ export namespace Aggregation.Query {
3647
4270
  export interface $center<S> {
3648
4271
  /**
3649
4272
  * Specifies a circle using legacy coordinate pairs to $geoWithin queries when using planar geometry. The 2d index supports $center.
4273
+ * New in MongoDB 2.4.
3650
4274
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/center/}
3651
4275
  */
3652
4276
  $center: unknown[];
@@ -3659,11 +4283,25 @@ export namespace Aggregation.Query {
3659
4283
  export interface $centerSphere<S> {
3660
4284
  /**
3661
4285
  * 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.
4286
+ * New in MongoDB 2.4.
3662
4287
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/}
3663
4288
  */
3664
4289
  $centerSphere: unknown[];
3665
4290
  }
3666
4291
 
4292
+ /**
4293
+ * A type describing the `$comment` operator.
4294
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/comment/}
4295
+ */
4296
+ export interface $comment<S> {
4297
+ /**
4298
+ * Adds a comment to a query predicate.
4299
+ * New in MongoDB 2.6.
4300
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/comment/}
4301
+ */
4302
+ $comment: string;
4303
+ }
4304
+
3667
4305
  /**
3668
4306
  * A type describing the `$elemMatch` operator.
3669
4307
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/}
@@ -3671,6 +4309,7 @@ export namespace Aggregation.Query {
3671
4309
  export interface $elemMatch<S> {
3672
4310
  /**
3673
4311
  * The $elemMatch operator matches documents that contain an array field with at least one element that matches all the specified query criteria.
4312
+ * New in MongoDB 2.4.
3674
4313
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/}
3675
4314
  */
3676
4315
  $elemMatch: Query<S> | FieldQuery<S>;
@@ -3683,9 +4322,10 @@ export namespace Aggregation.Query {
3683
4322
  export interface $eq<S> {
3684
4323
  /**
3685
4324
  * Matches values that are equal to a specified value.
4325
+ * New in MongoDB 3.0.
3686
4326
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/eq/}
3687
4327
  */
3688
- $eq: Expression<S>;
4328
+ $eq: any;
3689
4329
  }
3690
4330
 
3691
4331
  /**
@@ -3707,6 +4347,7 @@ export namespace Aggregation.Query {
3707
4347
  export interface $expr<S> {
3708
4348
  /**
3709
4349
  * Allows use of aggregation expressions within the query language.
4350
+ * New in MongoDB 3.6.
3710
4351
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/expr/}
3711
4352
  */
3712
4353
  $expr: Expression<S>;
@@ -3719,6 +4360,7 @@ export namespace Aggregation.Query {
3719
4360
  export interface $geoIntersects<S> {
3720
4361
  /**
3721
4362
  * Selects geometries that intersect with a GeoJSON geometry. The 2dsphere index supports $geoIntersects.
4363
+ * New in MongoDB 2.6.
3722
4364
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/geoIntersects/}
3723
4365
  */
3724
4366
  $geoIntersects: Geometry<S> & {};
@@ -3731,6 +4373,7 @@ export namespace Aggregation.Query {
3731
4373
  export interface $geoWithin<S> {
3732
4374
  /**
3733
4375
  * Selects geometries within a bounding GeoJSON geometry. The 2dsphere and 2d indexes support $geoWithin.
4376
+ * New in MongoDB 2.4.
3734
4377
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/}
3735
4378
  */
3736
4379
  $geoWithin: Geometry<S> & {};
@@ -3743,6 +4386,7 @@ export namespace Aggregation.Query {
3743
4386
  export interface $geometry<S> {
3744
4387
  /**
3745
4388
  * Specifies a geometry in GeoJSON format to geospatial query operators.
4389
+ * New in MongoDB 2.6.
3746
4390
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/geometry/}
3747
4391
  */
3748
4392
  $geometry: {
@@ -3795,6 +4439,7 @@ export namespace Aggregation.Query {
3795
4439
  export interface $jsonSchema<S> {
3796
4440
  /**
3797
4441
  * Validate documents against the given JSON Schema.
4442
+ * New in MongoDB 3.6.
3798
4443
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/jsonSchema/}
3799
4444
  */
3800
4445
  $jsonSchema: Record<string, unknown>;
@@ -3831,6 +4476,7 @@ export namespace Aggregation.Query {
3831
4476
  export interface $maxDistance<S> {
3832
4477
  /**
3833
4478
  * Specifies a maximum distance to limit the results of $near and $nearSphere queries. The 2dsphere and 2d indexes support $maxDistance.
4479
+ * New in MongoDB 2.4.
3834
4480
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/maxDistance/}
3835
4481
  */
3836
4482
  $maxDistance: Number;
@@ -3843,6 +4489,7 @@ export namespace Aggregation.Query {
3843
4489
  export interface $minDistance<S> {
3844
4490
  /**
3845
4491
  * Specifies a minimum distance to limit the results of $near and $nearSphere queries. For use with 2dsphere index only.
4492
+ * New in MongoDB 2.6.
3846
4493
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/minDistance/}
3847
4494
  */
3848
4495
  $minDistance: Int | Double;
@@ -3879,6 +4526,7 @@ export namespace Aggregation.Query {
3879
4526
  export interface $near<S> {
3880
4527
  /**
3881
4528
  * Returns geospatial objects in proximity to a point. Requires a geospatial index. The 2dsphere and 2d indexes support $near.
4529
+ * New in MongoDB 2.4.
3882
4530
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/near/}
3883
4531
  */
3884
4532
  $near: Geometry<S> & {
@@ -3901,6 +4549,7 @@ export namespace Aggregation.Query {
3901
4549
  export interface $nearSphere<S> {
3902
4550
  /**
3903
4551
  * Returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The 2dsphere and 2d indexes support $nearSphere.
4552
+ * New in MongoDB 2.4.
3904
4553
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/nearSphere/}
3905
4554
  */
3906
4555
  $nearSphere: Geometry<S> & {
@@ -3971,6 +4620,7 @@ export namespace Aggregation.Query {
3971
4620
  export interface $polygon<S> {
3972
4621
  /**
3973
4622
  * Specifies a polygon to using legacy coordinate pairs for $geoWithin queries. The 2d index supports $center.
4623
+ * New in MongoDB 2.4.
3974
4624
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/polygon/}
3975
4625
  */
3976
4626
  $polygon: unknown[];
@@ -3983,6 +4633,7 @@ export namespace Aggregation.Query {
3983
4633
  export interface $rand<S> {
3984
4634
  /**
3985
4635
  * Generates a random float between 0 and 1.
4636
+ * New in MongoDB 4.4.
3986
4637
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/rand/}
3987
4638
  */
3988
4639
  $rand: Record<string, never>;
@@ -4007,6 +4658,7 @@ export namespace Aggregation.Query {
4007
4658
  export interface $sampleRate<S> {
4008
4659
  /**
4009
4660
  * 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.
4661
+ * New in MongoDB 5.3.
4010
4662
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sampleRate/}
4011
4663
  */
4012
4664
  $sampleRate: ResolvesToDouble<S>;
@@ -4031,6 +4683,7 @@ export namespace Aggregation.Query {
4031
4683
  export interface $text<S> {
4032
4684
  /**
4033
4685
  * Performs text search.
4686
+ * New in MongoDB 2.4.
4034
4687
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/text/}
4035
4688
  */
4036
4689
  $text: {
@@ -4065,6 +4718,7 @@ export namespace Aggregation.Query {
4065
4718
  export interface $type<S> {
4066
4719
  /**
4067
4720
  * Selects documents if a field is of the specified type.
4721
+ * New in MongoDB 3.2.
4068
4722
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/query/type/}
4069
4723
  */
4070
4724
  $type: [...(Int | string)[]];
@@ -4093,6 +4747,7 @@ export namespace Aggregation.Search {
4093
4747
  * contains a sequence of characters from an incomplete input string. The
4094
4748
  * fields that you intend to query with the autocomplete operator must be
4095
4749
  * indexed with the autocomplete data type in the collection's index definition.
4750
+ * New in MongoDB 5.0.
4096
4751
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/}
4097
4752
  */
4098
4753
  autocomplete: {
@@ -4113,15 +4768,17 @@ export namespace Aggregation.Search {
4113
4768
  * The compound operator combines two or more operators into a single query.
4114
4769
  * Each element of a compound query is called a clause, and each clause
4115
4770
  * consists of one or more sub-queries.
4771
+ * New in MongoDB 5.0.
4116
4772
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/compound/}
4117
4773
  */
4118
4774
  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>[];
4775
+ must?: SearchOperator<S> | unknown[];
4776
+ mustNot?: SearchOperator<S> | unknown[];
4777
+ should?: SearchOperator<S> | unknown[];
4778
+ filter?: SearchOperator<S> | unknown[];
4123
4779
  minimumShouldMatch?: Int;
4124
4780
  score?: SearchScore;
4781
+ doesNotAffect?: string | unknown[];
4125
4782
  };
4126
4783
  }
4127
4784
 
@@ -4135,6 +4792,7 @@ export namespace Aggregation.Search {
4135
4792
  * It constrains multiple query predicates to be satisfied from a single
4136
4793
  * element of an array of embedded documents. embeddedDocument can be used only
4137
4794
  * for queries over fields of the embeddedDocuments
4795
+ * New in MongoDB 5.0.
4138
4796
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/embedded-document/}
4139
4797
  */
4140
4798
  embeddedDocument: {
@@ -4151,6 +4809,7 @@ export namespace Aggregation.Search {
4151
4809
  export interface Equals<S> {
4152
4810
  /**
4153
4811
  * The equals operator checks whether a field matches a value you specify.
4812
+ * New in MongoDB 5.0.
4154
4813
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/equals/}
4155
4814
  */
4156
4815
  equals: {
@@ -4164,6 +4823,7 @@ export namespace Aggregation.Search {
4164
4823
  | Number
4165
4824
  | string;
4166
4825
  score?: SearchScore;
4826
+ doesNotAffect?: string | unknown[];
4167
4827
  };
4168
4828
  }
4169
4829
 
@@ -4174,6 +4834,7 @@ export namespace Aggregation.Search {
4174
4834
  export interface Exists<S> {
4175
4835
  /**
4176
4836
  * The exists operator tests if a path to a specified indexed field name exists in a document.
4837
+ * New in MongoDB 5.0.
4177
4838
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/exists/}
4178
4839
  */
4179
4840
  exists: { path: SearchPath<S>; score?: SearchScore };
@@ -4187,6 +4848,7 @@ export namespace Aggregation.Search {
4187
4848
  /**
4188
4849
  * The facet collector groups results by values or ranges in the specified
4189
4850
  * faceted fields and returns the count for each of those groups.
4851
+ * New in MongoDB 5.0.
4190
4852
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/facet/}
4191
4853
  */
4192
4854
  facet: { facets: Record<string, unknown>; operator?: SearchOperator<S> };
@@ -4200,6 +4862,7 @@ export namespace Aggregation.Search {
4200
4862
  /**
4201
4863
  * The geoShape operator supports querying shapes with a relation to a given
4202
4864
  * geometry if indexShapes is set to true in the index definition.
4865
+ * New in MongoDB 5.0.
4203
4866
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/geoShape/}
4204
4867
  */
4205
4868
  geoShape: {
@@ -4219,6 +4882,7 @@ export namespace Aggregation.Search {
4219
4882
  * The geoWithin operator supports querying geographic points within a given
4220
4883
  * geometry. Only points are returned, even if indexShapes value is true in
4221
4884
  * the index definition.
4885
+ * New in MongoDB 5.0.
4222
4886
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/geoWithin/}
4223
4887
  */
4224
4888
  geoWithin: {
@@ -4230,6 +4894,32 @@ export namespace Aggregation.Search {
4230
4894
  };
4231
4895
  }
4232
4896
 
4897
+ /**
4898
+ * A type describing the `hasAncestor` operator.
4899
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasancestor/}
4900
+ */
4901
+ export interface HasAncestor<S> {
4902
+ /**
4903
+ * The `hasAncestor` operator queries an `embeddedDocuments` type field specified in the `ancestorPath`. The `ancestorPath` is a parent of the field specified in the `returnScope`.
4904
+ * New in MongoDB 8.2.
4905
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasancestor/}
4906
+ */
4907
+ hasAncestor: { ancestorPath: SearchPath<S>; operator: SearchOperator<S> };
4908
+ }
4909
+
4910
+ /**
4911
+ * A type describing the `hasRoot` operator.
4912
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasroot/}
4913
+ */
4914
+ export interface HasRoot<S> {
4915
+ /**
4916
+ * The `hasRoot` operator can be used to query root-level fields when you specify the `returnScope` and `returnStoredSource` options.
4917
+ * New in MongoDB 8.2.
4918
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/operators-collectors/hasroot/}
4919
+ */
4920
+ hasRoot: { operator: SearchOperator<S> };
4921
+ }
4922
+
4233
4923
  /**
4234
4924
  * A type describing the `in` operator.
4235
4925
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/in/}
@@ -4237,9 +4927,15 @@ export namespace Aggregation.Search {
4237
4927
  export interface In<S> {
4238
4928
  /**
4239
4929
  * The in operator performs a search for an array of BSON values in a field.
4930
+ * New in MongoDB 5.0.
4240
4931
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/in/}
4241
4932
  */
4242
- in: { path: SearchPath<S>; value: any | any[]; score?: SearchScore };
4933
+ in: {
4934
+ path: SearchPath<S>;
4935
+ value: any | unknown[];
4936
+ score?: SearchScore;
4937
+ doesNotAffect?: string | unknown[];
4938
+ };
4243
4939
  }
4244
4940
 
4245
4941
  /**
@@ -4251,10 +4947,11 @@ export namespace Aggregation.Search {
4251
4947
  * The moreLikeThis operator returns documents similar to input documents.
4252
4948
  * The moreLikeThis operator allows you to build features for your applications
4253
4949
  * that display similar or alternative results based on one or more given documents.
4950
+ * New in MongoDB 5.0.
4254
4951
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/moreLikeThis/}
4255
4952
  */
4256
4953
  moreLikeThis: {
4257
- like: Record<string, unknown> | Record<string, unknown>[];
4954
+ like: Record<string, unknown> | unknown[];
4258
4955
  score?: SearchScore;
4259
4956
  };
4260
4957
  }
@@ -4266,6 +4963,7 @@ export namespace Aggregation.Search {
4266
4963
  export interface Near<S> {
4267
4964
  /**
4268
4965
  * The near operator supports querying and scoring numeric, date, and GeoJSON point values.
4966
+ * New in MongoDB 5.0.
4269
4967
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/near/}
4270
4968
  */
4271
4969
  near: {
@@ -4283,11 +4981,12 @@ export namespace Aggregation.Search {
4283
4981
  export interface Phrase<S> {
4284
4982
  /**
4285
4983
  * The phrase operator performs search for documents containing an ordered sequence of terms using the analyzer specified in the index configuration.
4984
+ * New in MongoDB 5.0.
4286
4985
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/phrase/}
4287
4986
  */
4288
4987
  phrase: {
4289
4988
  path: SearchPath<S>;
4290
- query: string | string[];
4989
+ query: string | unknown[];
4291
4990
  slop?: Int;
4292
4991
  synonyms?: string;
4293
4992
  score?: SearchScore;
@@ -4310,6 +5009,7 @@ export namespace Aggregation.Search {
4310
5009
  /**
4311
5010
  * The range operator supports querying and scoring numeric, date, and string values.
4312
5011
  * You can use this operator to find results that are within a given numeric, date, objectId, or letter (from the English alphabet) range.
5012
+ * New in MongoDB 5.0.
4313
5013
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/range/}
4314
5014
  */
4315
5015
  range: {
@@ -4319,6 +5019,7 @@ export namespace Aggregation.Search {
4319
5019
  lt?: Date | Number | string | bson.ObjectId;
4320
5020
  lte?: Date | Number | string | bson.ObjectId;
4321
5021
  score?: SearchScore;
5022
+ doesNotAffect?: string | unknown[];
4322
5023
  };
4323
5024
  }
4324
5025
 
@@ -4330,6 +5031,7 @@ export namespace Aggregation.Search {
4330
5031
  /**
4331
5032
  * regex interprets the query field as a regular expression.
4332
5033
  * regex is a term-level operator, meaning that the query field isn't analyzed.
5034
+ * New in MongoDB 5.0.
4333
5035
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/regex/}
4334
5036
  */
4335
5037
  regex: {
@@ -4348,6 +5050,7 @@ export namespace Aggregation.Search {
4348
5050
  /**
4349
5051
  * The text operator performs a full-text search using the analyzer that you specify in the index configuration.
4350
5052
  * If you omit an analyzer, the text operator uses the default standard analyzer.
5053
+ * New in MongoDB 5.0.
4351
5054
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/text/}
4352
5055
  */
4353
5056
  text: {
@@ -4360,6 +5063,61 @@ export namespace Aggregation.Search {
4360
5063
  };
4361
5064
  }
4362
5065
 
5066
+ /**
5067
+ * A type describing the `vectorSearch` operator.
5068
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/vector-search/}
5069
+ */
5070
+ export interface VectorSearch<S> {
5071
+ /**
5072
+ * The vectorSearch operator performs an ANN or ENN search on a vector field. It can only be
5073
+ * used as a top-level operator in a $search or $searchMeta query, not nested under compound
5074
+ * or other operators.
5075
+ * New in MongoDB 6.0.
5076
+ * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/vector-search/}
5077
+ */
5078
+ vectorSearch: {
5079
+ /**
5080
+ * The indexed vector field to search.
5081
+ */
5082
+ path: SearchPath<S>;
5083
+
5084
+ /**
5085
+ * Array of numbers or a BinData value that represents the query vector. The number type
5086
+ * must match the indexed field value type.
5087
+ */
5088
+ queryVector: bson.Binary | unknown[];
5089
+
5090
+ /**
5091
+ * The integer number of documents to return in the results. This value cannot exceed
5092
+ * numCandidates if numCandidates is specified.
5093
+ */
5094
+ limit: Int;
5095
+
5096
+ /**
5097
+ * If false, runs an ANN search. If true, runs an ENN search. Defaults to false.
5098
+ * This parameter is required if numCandidates is omitted.
5099
+ */
5100
+ exact?: boolean;
5101
+
5102
+ /**
5103
+ * The number of nearest neighbors to use during the search. Value must be less than or
5104
+ * equal to 10000 and cannot be less than limit. This field is required if exact is false
5105
+ * or omitted.
5106
+ */
5107
+ numCandidates?: Int;
5108
+
5109
+ /**
5110
+ * Any Atlas Search operator to filter documents based on metadata or specific search criteria.
5111
+ */
5112
+ filter?: SearchOperator<S>;
5113
+
5114
+ /**
5115
+ * Score assigned to matching search results.
5116
+ */
5117
+ score?: SearchScore;
5118
+ };
5119
+ }
5120
+
4363
5121
  /**
4364
5122
  * A type describing the `wildcard` operator.
4365
5123
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/wildcard/}
@@ -4367,6 +5125,7 @@ export namespace Aggregation.Search {
4367
5125
  export interface Wildcard<S> {
4368
5126
  /**
4369
5127
  * The wildcard operator enables queries which use special characters in the search string that can match any character.
5128
+ * New in MongoDB 5.0.
4370
5129
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-search/wildcard/}
4371
5130
  */
4372
5131
  wildcard: {
@@ -4385,6 +5144,7 @@ export namespace Aggregation.Stage {
4385
5144
  export interface $addFields<S> {
4386
5145
  /**
4387
5146
  * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields.
5147
+ * New in MongoDB 3.4.
4388
5148
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/}
4389
5149
  */
4390
5150
  $addFields: {
@@ -4401,6 +5161,7 @@ export namespace Aggregation.Stage {
4401
5161
  export interface $bucket<S> {
4402
5162
  /**
4403
5163
  * Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.
5164
+ * New in MongoDB 3.4.
4404
5165
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/}
4405
5166
  */
4406
5167
  $bucket: {
@@ -4440,6 +5201,7 @@ export namespace Aggregation.Stage {
4440
5201
  export interface $bucketAuto<S> {
4441
5202
  /**
4442
5203
  * 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.
5204
+ * New in MongoDB 3.4.
4443
5205
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/}
4444
5206
  */
4445
5207
  $bucketAuto: {
@@ -4474,6 +5236,7 @@ export namespace Aggregation.Stage {
4474
5236
  export interface $changeStream<S> {
4475
5237
  /**
4476
5238
  * 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.
5239
+ * New in MongoDB 3.6.
4477
5240
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/}
4478
5241
  */
4479
5242
  $changeStream: {
@@ -4499,7 +5262,6 @@ export namespace Aggregation.Stage {
4499
5262
 
4500
5263
  /**
4501
5264
  * Specifies whether to include additional change events, such as such as DDL and index operations.
4502
- * New in MongoDB 6.0.
4503
5265
  */
4504
5266
  showExpandedEvents?: boolean;
4505
5267
 
@@ -4523,6 +5285,7 @@ export namespace Aggregation.Stage {
4523
5285
  /**
4524
5286
  * Splits large change stream events that exceed 16 MB into smaller fragments returned in a change stream cursor.
4525
5287
  * You can only use $changeStreamSplitLargeEvent in a $changeStream pipeline and it must be the final stage in the pipeline.
5288
+ * New in MongoDB 6.1.
4526
5289
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStreamSplitLargeEvent/}
4527
5290
  */
4528
5291
  $changeStreamSplitLargeEvent: Record<string, never>;
@@ -4535,6 +5298,7 @@ export namespace Aggregation.Stage {
4535
5298
  export interface $collStats<S> {
4536
5299
  /**
4537
5300
  * Returns statistics regarding a collection or view.
5301
+ * New in MongoDB 3.4.
4538
5302
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/}
4539
5303
  */
4540
5304
  $collStats: {
@@ -4553,6 +5317,7 @@ export namespace Aggregation.Stage {
4553
5317
  /**
4554
5318
  * Returns a count of the number of documents at this stage of the aggregation pipeline.
4555
5319
  * Distinct from the $count aggregation accumulator.
5320
+ * New in MongoDB 3.4.
4556
5321
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/count/}
4557
5322
  */
4558
5323
  $count: string;
@@ -4565,6 +5330,7 @@ export namespace Aggregation.Stage {
4565
5330
  export interface $currentOp<S> {
4566
5331
  /**
4567
5332
  * Returns information on active and/or dormant operations for the MongoDB deployment. To run, use the db.aggregate() method.
5333
+ * New in MongoDB 3.2.
4568
5334
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/}
4569
5335
  */
4570
5336
  $currentOp: {
@@ -4583,6 +5349,7 @@ export namespace Aggregation.Stage {
4583
5349
  export interface $densify<S> {
4584
5350
  /**
4585
5351
  * Creates new documents in a sequence of documents where certain values in a field are missing.
5352
+ * New in MongoDB 5.1.
4586
5353
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/densify/}
4587
5354
  */
4588
5355
  $densify: {
@@ -4612,6 +5379,7 @@ export namespace Aggregation.Stage {
4612
5379
  export interface $documents<S> {
4613
5380
  /**
4614
5381
  * Returns literal documents from input values.
5382
+ * New in MongoDB 5.1.
4615
5383
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/}
4616
5384
  */
4617
5385
  $documents: ResolvesToArray<S>;
@@ -4624,6 +5392,7 @@ export namespace Aggregation.Stage {
4624
5392
  export interface $facet<S> {
4625
5393
  /**
4626
5394
  * 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.
5395
+ * New in MongoDB 3.4.
4627
5396
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/}
4628
5397
  */
4629
5398
  $facet: {} & { [facet: string]: Pipeline<S> };
@@ -4636,6 +5405,7 @@ export namespace Aggregation.Stage {
4636
5405
  export interface $fill<S> {
4637
5406
  /**
4638
5407
  * Populates null and missing field values within documents.
5408
+ * New in MongoDB 5.3.
4639
5409
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/}
4640
5410
  */
4641
5411
  $fill: {
@@ -4673,6 +5443,7 @@ export namespace Aggregation.Stage {
4673
5443
  export interface $geoNear<S> {
4674
5444
  /**
4675
5445
  * 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.
5446
+ * New in MongoDB 2.4.
4676
5447
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/}
4677
5448
  */
4678
5449
  $geoNear: {
@@ -4736,6 +5507,7 @@ export namespace Aggregation.Stage {
4736
5507
  export interface $graphLookup<S> {
4737
5508
  /**
4738
5509
  * 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.
5510
+ * New in MongoDB 3.4.
4739
5511
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/}
4740
5512
  */
4741
5513
  $graphLookup: {
@@ -4748,7 +5520,7 @@ export namespace Aggregation.Stage {
4748
5520
  /**
4749
5521
  * 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
5522
  */
4751
- startWith: Expression<S> | Expression<S>[];
5523
+ startWith: Expression<S> | unknown[];
4752
5524
 
4753
5525
  /**
4754
5526
  * 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 +5561,7 @@ export namespace Aggregation.Stage {
4789
5561
  export interface $group<S> {
4790
5562
  /**
4791
5563
  * 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.
5564
+ * New in MongoDB 2.2.
4792
5565
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/}
4793
5566
  */
4794
5567
  $group: RecordWithStaticFields<
@@ -4796,7 +5569,7 @@ export namespace Aggregation.Stage {
4796
5569
  /**
4797
5570
  * 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
5571
  */
4799
- _id: Expression<S> | ExpressionMap<S>;
5572
+ _id: Expression<S>;
4800
5573
  },
4801
5574
  /**
4802
5575
  * Computed using the accumulator operators.
@@ -4812,6 +5585,7 @@ export namespace Aggregation.Stage {
4812
5585
  export interface $indexStats<S> {
4813
5586
  /**
4814
5587
  * Returns statistics regarding the use of each index for the collection.
5588
+ * New in MongoDB 3.0.
4815
5589
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/}
4816
5590
  */
4817
5591
  $indexStats: Record<string, never>;
@@ -4824,6 +5598,7 @@ export namespace Aggregation.Stage {
4824
5598
  export interface $limit<S> {
4825
5599
  /**
4826
5600
  * 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).
5601
+ * New in MongoDB 2.2.
4827
5602
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/}
4828
5603
  */
4829
5604
  $limit: Int;
@@ -4836,6 +5611,7 @@ export namespace Aggregation.Stage {
4836
5611
  export interface $listLocalSessions<S> {
4837
5612
  /**
4838
5613
  * 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.
5614
+ * New in MongoDB 3.6.
4839
5615
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/}
4840
5616
  */
4841
5617
  $listLocalSessions: {
@@ -4858,6 +5634,7 @@ export namespace Aggregation.Stage {
4858
5634
  export interface $listSampledQueries<S> {
4859
5635
  /**
4860
5636
  * Lists sampled queries for all collections or a specific collection.
5637
+ * New in MongoDB 5.0.
4861
5638
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/}
4862
5639
  */
4863
5640
  $listSampledQueries: { namespace?: string };
@@ -4870,6 +5647,7 @@ export namespace Aggregation.Stage {
4870
5647
  export interface $listSearchIndexes<S> {
4871
5648
  /**
4872
5649
  * Returns information about existing Atlas Search indexes on a specified collection.
5650
+ * New in MongoDB 7.0.
4873
5651
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/}
4874
5652
  */
4875
5653
  $listSearchIndexes: {
@@ -4892,6 +5670,7 @@ export namespace Aggregation.Stage {
4892
5670
  export interface $listSessions<S> {
4893
5671
  /**
4894
5672
  * Lists all sessions that have been active long enough to propagate to the system.sessions collection.
5673
+ * New in MongoDB 3.6.
4895
5674
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/}
4896
5675
  */
4897
5676
  $listSessions: {
@@ -4914,6 +5693,7 @@ export namespace Aggregation.Stage {
4914
5693
  export interface $lookup<S> {
4915
5694
  /**
4916
5695
  * Performs a left outer join to another collection in the same database to filter in documents from the "joined" collection for processing.
5696
+ * New in MongoDB 3.2.
4917
5697
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/}
4918
5698
  */
4919
5699
  $lookup: {
@@ -4944,7 +5724,7 @@ export namespace Aggregation.Stage {
4944
5724
  * 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
5725
  * 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
5726
  */
4947
- pipeline?: UntypedPipeline;
5727
+ pipeline?: Pipeline<S>;
4948
5728
 
4949
5729
  /**
4950
5730
  * 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 +5740,7 @@ export namespace Aggregation.Stage {
4960
5740
  export interface $match<S> {
4961
5741
  /**
4962
5742
  * 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).
5743
+ * New in MongoDB 2.2.
4963
5744
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/}
4964
5745
  */
4965
5746
  $match: Query<S>;
@@ -4984,7 +5765,7 @@ export namespace Aggregation.Stage {
4984
5765
  /**
4985
5766
  * 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
5767
  */
4987
- on?: string | string[];
5768
+ on?: string | unknown[];
4988
5769
 
4989
5770
  /**
4990
5771
  * Specifies variables for use in the whenMatched pipeline.
@@ -4994,7 +5775,7 @@ export namespace Aggregation.Stage {
4994
5775
  /**
4995
5776
  * 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
5777
  */
4997
- whenMatched?: WhenMatched | UntypedPipeline;
5778
+ whenMatched?: WhenMatched | UpdatePipeline<S>;
4998
5779
 
4999
5780
  /**
5000
5781
  * The behavior of $merge if a result document does not match an existing document in the out collection.
@@ -5010,9 +5791,51 @@ export namespace Aggregation.Stage {
5010
5791
  export interface $out<S> {
5011
5792
  /**
5012
5793
  * 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.
5794
+ * New in MongoDB 2.6.
5013
5795
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/}
5014
5796
  */
5015
- $out: string | OutCollection;
5797
+ $out: {
5798
+ /**
5799
+ * The output collection name.
5800
+ */
5801
+ coll: string;
5802
+
5803
+ /**
5804
+ * The output database name. If omitted, defaults to the current database.
5805
+ */
5806
+ db?: string;
5807
+
5808
+ /**
5809
+ * Specifies the configuration to use when writing to a time series collection.
5810
+ * The timeField is required. All other fields are optional.
5811
+ */
5812
+ timeseries?: {
5813
+ /**
5814
+ * The name of the field which contains the date in each time series document.
5815
+ */
5816
+ timeField: string;
5817
+
5818
+ /**
5819
+ * The name of the field which contains metadata in each time series document.
5820
+ */
5821
+ metaField?: string;
5822
+
5823
+ /**
5824
+ * The granularity of time measurements. Value can be seconds, minutes, or hours.
5825
+ */
5826
+ granularity?: TimeGranularity;
5827
+
5828
+ /**
5829
+ * The maximum time span between measurements in a bucket.
5830
+ */
5831
+ bucketMaxSpanSeconds?: Int;
5832
+
5833
+ /**
5834
+ * The interval that determines the starting timestamp for a new bucket.
5835
+ */
5836
+ bucketRoundingSeconds?: Int;
5837
+ };
5838
+ };
5016
5839
  }
5017
5840
 
5018
5841
  /**
@@ -5022,6 +5845,7 @@ export namespace Aggregation.Stage {
5022
5845
  export interface $planCacheStats<S> {
5023
5846
  /**
5024
5847
  * Returns plan cache information for a collection.
5848
+ * New in MongoDB 4.4.
5025
5849
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/}
5026
5850
  */
5027
5851
  $planCacheStats: Record<string, never>;
@@ -5034,10 +5858,47 @@ export namespace Aggregation.Stage {
5034
5858
  export interface $project<S> {
5035
5859
  /**
5036
5860
  * Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document.
5861
+ * New in MongoDB 2.2.
5037
5862
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/}
5038
5863
  */
5039
- $project: {} & {
5040
- [specification: string]: Expression<S> | ExpressionMap<S>;
5864
+ $project: {} & { [specification: string]: Expression<S> };
5865
+ }
5866
+
5867
+ /**
5868
+ * A type describing the `$rankFusion` operator.
5869
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rankFusion/}
5870
+ */
5871
+ export interface $rankFusion<S> {
5872
+ /**
5873
+ * Combines multiple pipelines using rank-based fusion to create hybrid search results.
5874
+ * New in MongoDB 8.1.
5875
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/rankFusion/}
5876
+ */
5877
+ $rankFusion: {
5878
+ /**
5879
+ * An object that specifies the pipelines to combine with rank fusion.
5880
+ */
5881
+ input: {
5882
+ /**
5883
+ * Map from name to ranked input pipeline. Each pipeline must operate on the same collection.
5884
+ */
5885
+ pipelines: Pipeline<S>;
5886
+ };
5887
+
5888
+ /**
5889
+ * An object that specifies how to combine the ranked results.
5890
+ */
5891
+ combination?: {
5892
+ /**
5893
+ * Map from pipeline name to weight (non-negative number). If unspecified, default weight is 1 for each pipeline.
5894
+ */
5895
+ weights?: Number;
5896
+ };
5897
+
5898
+ /**
5899
+ * Set to true to include detailed scoring information.
5900
+ */
5901
+ scoreDetails?: boolean;
5041
5902
  };
5042
5903
  }
5043
5904
 
@@ -5048,6 +5909,7 @@ export namespace Aggregation.Stage {
5048
5909
  export interface $redact<S> {
5049
5910
  /**
5050
5911
  * 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.
5912
+ * New in MongoDB 2.6.
5051
5913
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/}
5052
5914
  */
5053
5915
  $redact: Expression<S>;
@@ -5060,6 +5922,7 @@ export namespace Aggregation.Stage {
5060
5922
  export interface $replaceRoot<S> {
5061
5923
  /**
5062
5924
  * 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.
5925
+ * New in MongoDB 3.4.
5063
5926
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/}
5064
5927
  */
5065
5928
  $replaceRoot: { newRoot: ResolvesToObject<S> };
@@ -5073,11 +5936,50 @@ export namespace Aggregation.Stage {
5073
5936
  /**
5074
5937
  * 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
5938
  * Alias for $replaceRoot.
5939
+ * New in MongoDB 4.2.
5076
5940
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/}
5077
5941
  */
5078
5942
  $replaceWith: ResolvesToObject<S>;
5079
5943
  }
5080
5944
 
5945
+ /**
5946
+ * A type describing the `$rerank` operator.
5947
+ * @see {@link https://www.mongodb.com/docs/vector-search/query/aggregation-stages/rerank/}
5948
+ */
5949
+ export interface $rerank<S> {
5950
+ /**
5951
+ * Reranks documents using a Voyage AI reranking model to improve relevance scoring.
5952
+ * New in MongoDB 8.3.
5953
+ * @see {@link https://www.mongodb.com/docs/vector-search/query/aggregation-stages/rerank/}
5954
+ */
5955
+ $rerank: {
5956
+ /**
5957
+ * Name of the Voyage AI reranking model to use (e.g. rerank-2.5, rerank-2.5-lite).
5958
+ */
5959
+ model: string;
5960
+
5961
+ /**
5962
+ * Query object for reranking.
5963
+ */
5964
+ query: {
5965
+ /**
5966
+ * Query text used to score document relevance.
5967
+ */
5968
+ text: string;
5969
+ };
5970
+
5971
+ /**
5972
+ * Field path or array of field paths to use for reranking.
5973
+ */
5974
+ path: string | unknown[];
5975
+
5976
+ /**
5977
+ * Maximum number of documents to send to Voyage AI for reranking. Value must be between 1 and 1000.
5978
+ */
5979
+ numDocsToRerank: Int;
5980
+ };
5981
+ }
5982
+
5081
5983
  /**
5082
5984
  * A type describing the `$sample` operator.
5083
5985
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/}
@@ -5085,6 +5987,7 @@ export namespace Aggregation.Stage {
5085
5987
  export interface $sample<S> {
5086
5988
  /**
5087
5989
  * Randomly selects the specified number of documents from its input.
5990
+ * New in MongoDB 3.2.
5088
5991
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/}
5089
5992
  */
5090
5993
  $sample: {
@@ -5095,6 +5998,98 @@ export namespace Aggregation.Stage {
5095
5998
  };
5096
5999
  }
5097
6000
 
6001
+ /**
6002
+ * A type describing the `$score` operator.
6003
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/score/}
6004
+ */
6005
+ export interface $score<S> {
6006
+ /**
6007
+ * Computes and returns a new score as metadata. It also optionally normalizes the input
6008
+ * scores, by default to a range between zero and one.
6009
+ * New in MongoDB 8.2.
6010
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/score/}
6011
+ */
6012
+ $score: {
6013
+ /**
6014
+ * Computes a new value from the input scores and stores the value in the $meta keyword
6015
+ * score. Returns an error for non-numeric inputs.
6016
+ */
6017
+ score: Expression<S>;
6018
+
6019
+ /**
6020
+ * Normalizes the score to the range of 0 to 1. Value can be:
6021
+ * - none: Doesn't normalize. If omitted, defaults to none.
6022
+ * - sigmoid: Applies the sigmoid expression: 1 / (1 + e^-x).
6023
+ * - minMaxScaler: Applies the $minMaxScaler window function.
6024
+ */
6025
+ normalization?: ScoreNormalization;
6026
+
6027
+ /**
6028
+ * Number to multiply the score expression by after normalization.
6029
+ */
6030
+ weight?: Expression<S>;
6031
+
6032
+ /**
6033
+ * Specifies if $score computes and populates the $scoreDetails metadata field for each
6034
+ * output document.
6035
+ */
6036
+ scoreDetails?: boolean;
6037
+ };
6038
+ }
6039
+
6040
+ /**
6041
+ * A type describing the `$scoreFusion` operator.
6042
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/scoreFusion/}
6043
+ */
6044
+ export interface $scoreFusion<S> {
6045
+ /**
6046
+ * Combines multiple pipelines using relative score fusion to create hybrid search results.
6047
+ * New in MongoDB 8.0.
6048
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/scoreFusion/}
6049
+ */
6050
+ $scoreFusion: {
6051
+ /**
6052
+ * An object that specifies the pipelines to combine with score fusion.
6053
+ */
6054
+ input: {
6055
+ /**
6056
+ * Map from name to input pipeline. Each pipeline must be operating on the same collection.
6057
+ */
6058
+ pipelines: Pipeline<S>;
6059
+
6060
+ /**
6061
+ * Normalizes the score to the range 0 to 1 before combining the results. Value can be none, sigmoid or minMaxScaler.
6062
+ */
6063
+ normalization: string;
6064
+ };
6065
+
6066
+ /**
6067
+ * An object that specifies how to combine the scores.
6068
+ */
6069
+ combination?: {
6070
+ /**
6071
+ * Map from pipeline name to weight (non-negative number). If unspecified, default weight is 1 for each pipeline.
6072
+ */
6073
+ weights?: Number;
6074
+
6075
+ /**
6076
+ * Specifies method for combining scores. Value can be avg or expression. Default is avg.
6077
+ */
6078
+ method?: string;
6079
+
6080
+ /**
6081
+ * Custom expression used when combination.method is set to expression.
6082
+ */
6083
+ expression?: Expression<S>;
6084
+ };
6085
+
6086
+ /**
6087
+ * Set to true to include detailed scoring information.
6088
+ */
6089
+ scoreDetails?: boolean;
6090
+ };
6091
+ }
6092
+
5098
6093
  /**
5099
6094
  * A type describing the `$search` operator.
5100
6095
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/}
@@ -5103,6 +6098,7 @@ export namespace Aggregation.Stage {
5103
6098
  /**
5104
6099
  * Performs a full-text search of the field or fields in an Atlas collection.
5105
6100
  * NOTE: $search is only available for MongoDB Atlas clusters, and is not available for self-managed deployments.
6101
+ * New in MongoDB 5.0.
5106
6102
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/}
5107
6103
  */
5108
6104
  $search: SearchOperator<S> & {
@@ -5114,7 +6110,7 @@ export namespace Aggregation.Stage {
5114
6110
  /**
5115
6111
  * Specifies the highlighting options for displaying search terms in their original context.
5116
6112
  */
5117
- highlight?: SearchHighlight<S>;
6113
+ highlight?: Record<string, unknown>;
5118
6114
 
5119
6115
  /**
5120
6116
  * Parallelize search across segments on dedicated search nodes.
@@ -5148,6 +6144,11 @@ export namespace Aggregation.Stage {
5148
6144
  */
5149
6145
  sort?: Record<string, unknown>;
5150
6146
 
6147
+ /**
6148
+ * Object that sets the context of the query to the specified embedded document field. You must also specify `returnStoredSource` and set it to `true`.
6149
+ */
6150
+ returnScope?: Record<string, unknown>;
6151
+
5151
6152
  /**
5152
6153
  * 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
6154
  */
@@ -5168,6 +6169,7 @@ export namespace Aggregation.Stage {
5168
6169
  /**
5169
6170
  * Returns different types of metadata result documents for the Atlas Search query against an Atlas collection.
5170
6171
  * NOTE: $searchMeta is only available for MongoDB Atlas clusters running MongoDB v4.4.9 or higher, and is not available for self-managed deployments.
6172
+ * New in MongoDB 5.0.
5171
6173
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/searchMeta/}
5172
6174
  */
5173
6175
  $searchMeta: SearchOperator<S> & {
@@ -5180,6 +6182,16 @@ export namespace Aggregation.Stage {
5180
6182
  * Document that specifies the count options for retrieving a count of the results.
5181
6183
  */
5182
6184
  count?: Record<string, unknown>;
6185
+
6186
+ /**
6187
+ * 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.
6188
+ */
6189
+ returnScope?: Record<string, unknown>;
6190
+
6191
+ /**
6192
+ * Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search.
6193
+ */
6194
+ returnStoredSource?: boolean;
5183
6195
  };
5184
6196
  }
5185
6197
 
@@ -5191,6 +6203,7 @@ export namespace Aggregation.Stage {
5191
6203
  /**
5192
6204
  * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields.
5193
6205
  * Alias for $addFields.
6206
+ * New in MongoDB 4.2.
5194
6207
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/}
5195
6208
  */
5196
6209
  $set: {} & { [field: string]: Expression<S> };
@@ -5245,6 +6258,7 @@ export namespace Aggregation.Stage {
5245
6258
  export interface $skip<S> {
5246
6259
  /**
5247
6260
  * 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).
6261
+ * New in MongoDB 2.2.
5248
6262
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/}
5249
6263
  */
5250
6264
  $skip: Int;
@@ -5257,6 +6271,7 @@ export namespace Aggregation.Stage {
5257
6271
  export interface $sort<S> {
5258
6272
  /**
5259
6273
  * Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document.
6274
+ * New in MongoDB 2.2.
5260
6275
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/}
5261
6276
  */
5262
6277
  $sort: {} & { [sort: string]: Expression<S> | SortSpec };
@@ -5269,6 +6284,7 @@ export namespace Aggregation.Stage {
5269
6284
  export interface $sortByCount<S> {
5270
6285
  /**
5271
6286
  * Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group.
6287
+ * New in MongoDB 3.4.
5272
6288
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/}
5273
6289
  */
5274
6290
  $sortByCount: Expression<S>;
@@ -5294,7 +6310,7 @@ export namespace Aggregation.Stage {
5294
6310
  * An aggregation pipeline to apply to the specified coll.
5295
6311
  * 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
6312
  */
5297
- pipeline?: UntypedPipeline;
6313
+ pipeline?: Pipeline<S>;
5298
6314
  };
5299
6315
  }
5300
6316
 
@@ -5306,6 +6322,7 @@ export namespace Aggregation.Stage {
5306
6322
  /**
5307
6323
  * Removes or excludes fields from documents.
5308
6324
  * Alias for $project stage that removes or excludes fields.
6325
+ * New in MongoDB 4.2.
5309
6326
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/}
5310
6327
  */
5311
6328
  $unset: [...UnprefixedFieldPath<S>[]];
@@ -5318,6 +6335,7 @@ export namespace Aggregation.Stage {
5318
6335
  export interface $unwind<S> {
5319
6336
  /**
5320
6337
  * 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.
6338
+ * New in MongoDB 2.2.
5321
6339
  * @see {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/}
5322
6340
  */
5323
6341
  $unwind: {
@@ -5347,6 +6365,7 @@ export namespace Aggregation.Stage {
5347
6365
  export interface $vectorSearch<S> {
5348
6366
  /**
5349
6367
  * The $vectorSearch stage performs an ANN or ENN search on a vector in the specified field.
6368
+ * New in MongoDB 6.0.
5350
6369
  * @see {@link https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/}
5351
6370
  */
5352
6371
  $vectorSearch: {
@@ -5366,9 +6385,10 @@ export namespace Aggregation.Stage {
5366
6385
  path: string;
5367
6386
 
5368
6387
  /**
5369
- * Array of numbers that represent the query vector. The number type must match the indexed field value type.
6388
+ * Array of numbers or a BinData value that represent the query vector. The number type
6389
+ * must match the indexed field value type.
5370
6390
  */
5371
- queryVector: unknown[];
6391
+ queryVector: bson.Binary | unknown[];
5372
6392
 
5373
6393
  /**
5374
6394
  * This is required if numCandidates is omitted. false to run ANN search. true to run ENN search.
@@ -5376,7 +6396,7 @@ export namespace Aggregation.Stage {
5376
6396
  exact?: boolean;
5377
6397
 
5378
6398
  /**
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.
6399
+ * Any match query that compares an indexed field with a boolean, date, objectId, number, string, or UUID to use as a pre-filter.
5380
6400
  */
5381
6401
  filter?: Query<S>;
5382
6402
 
@@ -5385,15 +6405,230 @@ export namespace Aggregation.Stage {
5385
6405
  * 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
6406
  */
5387
6407
  numCandidates?: Int;
6408
+
6409
+ /**
6410
+ * 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.
6411
+ */
6412
+ returnStoredSource?: boolean;
6413
+
6414
+ /**
6415
+ * Configure how MongoDB Vector Search scores documents that contain nested arrays.
6416
+ */
6417
+ nestedOptions?: {
6418
+ /**
6419
+ * Specifies how to score documents that contain nested arrays. Value can be avg or max.
6420
+ */
6421
+ scoreMode?: string;
6422
+ };
6423
+
6424
+ /**
6425
+ * 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.
6426
+ */
6427
+ parentFilter?: Query<S>;
5388
6428
  };
5389
6429
  }
5390
6430
  }
6431
+ export namespace Aggregation.Update {
6432
+ /**
6433
+ * A type describing the `$addToSet` operator.
6434
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/addToSet/}
6435
+ */
6436
+ export interface $addToSet<S> {
6437
+ /**
6438
+ * Adds a value to an array unless the value is already present.
6439
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/addToSet/}
6440
+ */
6441
+ $addToSet: {} & { [field: string]: any };
6442
+ }
6443
+
6444
+ /**
6445
+ * A type describing the `$bit` operator.
6446
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/bit/}
6447
+ */
6448
+ export interface $bit<S> {
6449
+ /**
6450
+ * Performs bitwise updates of integer values.
6451
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/bit/}
6452
+ */
6453
+ $bit: {
6454
+ /**
6455
+ * Each field maps to an object containing exactly one bitwise operation:
6456
+ * and, or, or xor.
6457
+ */
6458
+ } & { [field: string]: BitwiseOperation };
6459
+ }
6460
+
6461
+ /**
6462
+ * A type describing the `$currentDate` operator.
6463
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/currentDate/}
6464
+ */
6465
+ export interface $currentDate<S> {
6466
+ /**
6467
+ * Sets the value of a field to the current date as either a Date or Timestamp.
6468
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/currentDate/}
6469
+ */
6470
+ $currentDate: {
6471
+ /**
6472
+ * The value for each field can be either:
6473
+ * - true, to set the field to the current date.
6474
+ * - a document with $type set to "date" or "timestamp".
6475
+ */
6476
+ } & { [field: string]: boolean | Record<string, unknown> };
6477
+ }
6478
+
6479
+ /**
6480
+ * A type describing the `$inc` operator.
6481
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/inc/}
6482
+ */
6483
+ export interface $inc<S> {
6484
+ /**
6485
+ * Increments a field by the specified numeric amount.
6486
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/inc/}
6487
+ */
6488
+ $inc: {} & { [field: string]: Number };
6489
+ }
6490
+
6491
+ /**
6492
+ * A type describing the `$max` operator.
6493
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/max/}
6494
+ */
6495
+ export interface $max<S> {
6496
+ /**
6497
+ * Updates a field only if the specified value is greater than the current field value.
6498
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/max/}
6499
+ */
6500
+ $max: {} & { [field: string]: any };
6501
+ }
6502
+
6503
+ /**
6504
+ * A type describing the `$min` operator.
6505
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/min/}
6506
+ */
6507
+ export interface $min<S> {
6508
+ /**
6509
+ * Updates a field only if the specified value is less than the current field value.
6510
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/min/}
6511
+ */
6512
+ $min: {} & { [field: string]: any };
6513
+ }
6514
+
6515
+ /**
6516
+ * A type describing the `$mul` operator.
6517
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/mul/}
6518
+ */
6519
+ export interface $mul<S> {
6520
+ /**
6521
+ * Multiplies the value of a field by the specified number.
6522
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/mul/}
6523
+ */
6524
+ $mul: {} & { [field: string]: Number };
6525
+ }
6526
+
6527
+ /**
6528
+ * A type describing the `$pop` operator.
6529
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pop/}
6530
+ */
6531
+ export interface $pop<S> {
6532
+ /**
6533
+ * Removes the first or last element of an array.
6534
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pop/}
6535
+ */
6536
+ $pop: {} & { [field: string]: Int };
6537
+ }
6538
+
6539
+ /**
6540
+ * A type describing the `$pull` operator.
6541
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pull/}
6542
+ */
6543
+ export interface $pull<S> {
6544
+ /**
6545
+ * Removes all array elements that match a specified value or condition.
6546
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pull/}
6547
+ */
6548
+ $pull: {} & { [field: string]: FieldQuery<S> };
6549
+ }
6550
+
6551
+ /**
6552
+ * A type describing the `$pullAll` operator.
6553
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pullAll/}
6554
+ */
6555
+ export interface $pullAll<S> {
6556
+ /**
6557
+ * Removes all matching values from an array.
6558
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/pullAll/}
6559
+ */
6560
+ $pullAll: {} & { [field: string]: unknown[] };
6561
+ }
6562
+
6563
+ /**
6564
+ * A type describing the `$push` operator.
6565
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/push/}
6566
+ */
6567
+ export interface $push<S> {
6568
+ /**
6569
+ * Appends a specified value to an array, with optional modifiers.
6570
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/push/}
6571
+ */
6572
+ $push: {} & { [field: string]: any };
6573
+ }
6574
+
6575
+ /**
6576
+ * A type describing the `$rename` operator.
6577
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/rename/}
6578
+ */
6579
+ export interface $rename<S> {
6580
+ /**
6581
+ * Renames a field.
6582
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/rename/}
6583
+ */
6584
+ $rename: {} & { [field: string]: string };
6585
+ }
6586
+
6587
+ /**
6588
+ * A type describing the `$set` operator.
6589
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/set/}
6590
+ */
6591
+ export interface $set<S> {
6592
+ /**
6593
+ * Sets the value of a field.
6594
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/set/}
6595
+ */
6596
+ $set: {} & { [field: string]: any };
6597
+ }
6598
+
6599
+ /**
6600
+ * A type describing the `$setOnInsert` operator.
6601
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/}
6602
+ */
6603
+ export interface $setOnInsert<S> {
6604
+ /**
6605
+ * Sets the value of a field if an update with upsert creates a new document.
6606
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/}
6607
+ */
6608
+ $setOnInsert: {} & { [field: string]: any };
6609
+ }
6610
+
6611
+ /**
6612
+ * A type describing the `$unset` operator.
6613
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/unset/}
6614
+ */
6615
+ export interface $unset<S> {
6616
+ /**
6617
+ * Removes the specified field from a document.
6618
+ * @see {@link https://www.mongodb.com/docs/manual/reference/operator/update/unset/}
6619
+ */
6620
+ $unset: {} & { [field: string]: any };
6621
+ }
6622
+ }
5391
6623
 
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;
6624
+ export type Int = number | bson.Int32 | { $numberInt: string };
6625
+ export type Double = number | bson.Double | { $numberDouble: string };
6626
+ export type Decimal = bson.Decimal128 | { $numberDecimal: string };
6627
+ export type Regex =
6628
+ | RegExp
6629
+ | bson.BSONRegExp
6630
+ | { pattern: string; options?: string };
6631
+ export type Long = bigint | bson.Long | { $numberLong: string };
5397
6632
  export type Javascript = bson.Code | Function | string;
5398
6633
  export type Geometry<S> =
5399
6634
  | { type: 'Point'; coordinates: number[] }
@@ -5423,8 +6658,14 @@ export type SearchPath<S> =
5423
6658
  | UnprefixedFieldPath<S>
5424
6659
  | UnprefixedFieldPath<S>[]
5425
6660
  | { wildcard: string };
6661
+ export type BitwiseOperation =
6662
+ | { and: Int | Long }
6663
+ | { or: Int | Long }
6664
+ | { xor: Int | Long };
5426
6665
  export type SearchScore = unknown;
5427
6666
  export type Granularity = string;
6667
+ export type TimeGranularity = 'seconds' | 'minutes' | 'hours';
6668
+ export type ScoreNormalization = 'none' | 'sigmoid' | 'minMaxScaler';
5428
6669
  export type FullDocument = string;
5429
6670
  export type FullDocumentBeforeChange = string;
5430
6671
  export type AccumulatorPercentile = string;
@@ -5459,36 +6700,27 @@ export type Stage<S> =
5459
6700
  | Aggregation.Stage.$addFields<S>
5460
6701
  | Aggregation.Stage.$bucket<S>
5461
6702
  | Aggregation.Stage.$bucketAuto<S>
5462
- | Aggregation.Stage.$changeStream<S>
5463
- | Aggregation.Stage.$changeStreamSplitLargeEvent<S>
5464
- | Aggregation.Stage.$collStats<S>
5465
6703
  | Aggregation.Stage.$count<S>
5466
- | Aggregation.Stage.$currentOp<S>
5467
6704
  | Aggregation.Stage.$densify<S>
5468
- | Aggregation.Stage.$documents<S>
5469
6705
  | Aggregation.Stage.$facet<S>
5470
6706
  | Aggregation.Stage.$fill<S>
5471
- | Aggregation.Stage.$geoNear<S>
5472
6707
  | Aggregation.Stage.$graphLookup<S>
5473
6708
  | Aggregation.Stage.$group<S>
5474
- | Aggregation.Stage.$indexStats<S>
5475
6709
  | Aggregation.Stage.$limit<S>
5476
- | Aggregation.Stage.$listLocalSessions<S>
5477
6710
  | Aggregation.Stage.$listSampledQueries<S>
5478
6711
  | Aggregation.Stage.$listSearchIndexes<S>
5479
- | Aggregation.Stage.$listSessions<S>
5480
6712
  | Aggregation.Stage.$lookup<S>
5481
6713
  | Aggregation.Stage.$match<S>
5482
- | Aggregation.Stage.$merge<S>
5483
- | Aggregation.Stage.$out<S>
5484
6714
  | Aggregation.Stage.$planCacheStats<S>
5485
6715
  | Aggregation.Stage.$project<S>
6716
+ | Aggregation.Stage.$rankFusion<S>
5486
6717
  | Aggregation.Stage.$redact<S>
5487
6718
  | Aggregation.Stage.$replaceRoot<S>
5488
6719
  | Aggregation.Stage.$replaceWith<S>
6720
+ | Aggregation.Stage.$rerank<S>
5489
6721
  | Aggregation.Stage.$sample<S>
5490
- | Aggregation.Stage.$search<S>
5491
- | Aggregation.Stage.$searchMeta<S>
6722
+ | Aggregation.Stage.$score<S>
6723
+ | Aggregation.Stage.$scoreFusion<S>
5492
6724
  | Aggregation.Stage.$set<S>
5493
6725
  | Aggregation.Stage.$setWindowFields<S>
5494
6726
  | Aggregation.Stage.$shardedDataDistribution<S>
@@ -5497,14 +6729,15 @@ export type Stage<S> =
5497
6729
  | Aggregation.Stage.$sortByCount<S>
5498
6730
  | Aggregation.Stage.$unionWith<S>
5499
6731
  | Aggregation.Stage.$unset<S>
5500
- | Aggregation.Stage.$unwind<S>
5501
- | Aggregation.Stage.$vectorSearch<S>;
6732
+ | Aggregation.Stage.$unwind<S>;
5502
6733
  export type Pipeline<S> = Stage<S>[];
6734
+ export type UpdatePipeline<S> = UpdateStage<S>[];
5503
6735
  export type UntypedPipeline = Pipeline<any>;
5504
6736
  export type Query<S> =
5505
6737
  | QueryOperator<S>
5506
6738
  | Partial<{ [k in keyof S]: Condition<S[k]> }>
5507
6739
  | Aggregation.Query.$and<S>
6740
+ | Aggregation.Query.$comment<S>
5508
6741
  | Aggregation.Query.$expr<S>
5509
6742
  | Aggregation.Query.$jsonSchema<S>
5510
6743
  | Aggregation.Query.$nor<S>
@@ -5518,6 +6751,7 @@ export type Accumulator<S> =
5518
6751
  | Aggregation.Accumulator.$avg<S>
5519
6752
  | Aggregation.Accumulator.$bottom<S>
5520
6753
  | Aggregation.Accumulator.$bottomN<S>
6754
+ | Aggregation.Accumulator.$concatArrays<S>
5521
6755
  | Aggregation.Accumulator.$count<S>
5522
6756
  | Aggregation.Accumulator.$first<S>
5523
6757
  | Aggregation.Accumulator.$firstN<S>
@@ -5531,6 +6765,7 @@ export type Accumulator<S> =
5531
6765
  | Aggregation.Accumulator.$minN<S>
5532
6766
  | Aggregation.Accumulator.$percentile<S>
5533
6767
  | Aggregation.Accumulator.$push<S>
6768
+ | Aggregation.Accumulator.$setUnion<S>
5534
6769
  | Aggregation.Accumulator.$stdDevPop<S>
5535
6770
  | Aggregation.Accumulator.$stdDevSamp<S>
5536
6771
  | Aggregation.Accumulator.$sum<S>
@@ -5602,6 +6837,10 @@ export type ResolvesToDouble<S> =
5602
6837
  | Aggregation.Expression.$radiansToDegrees<S>
5603
6838
  | Aggregation.Expression.$rand<S>
5604
6839
  | Aggregation.Expression.$round<S>
6840
+ | Aggregation.Expression.$sigmoid<S>
6841
+ | Aggregation.Expression.$similarityCosine<S>
6842
+ | Aggregation.Expression.$similarityDotProduct<S>
6843
+ | Aggregation.Expression.$similarityEuclidean<S>
5605
6844
  | Aggregation.Expression.$sin<S>
5606
6845
  | Aggregation.Expression.$sinh<S>
5607
6846
  | Aggregation.Expression.$sqrt<S>
@@ -5618,6 +6857,7 @@ export type ResolvesToString<S> =
5618
6857
  | string
5619
6858
  | Aggregation.Expression.$concat<S>
5620
6859
  | Aggregation.Expression.$dateToString<S>
6860
+ | Aggregation.Expression.$hexHash<S>
5621
6861
  | Aggregation.Expression.$ltrim<S>
5622
6862
  | Aggregation.Expression.$replaceAll<S>
5623
6863
  | Aggregation.Expression.$replaceOne<S>
@@ -5638,14 +6878,20 @@ export type ResolvesToObject<S> =
5638
6878
  | Record<string, unknown>
5639
6879
  | Aggregation.Expression.$arrayToObject<S>
5640
6880
  | Aggregation.Expression.$dateToParts<S>
6881
+ | Aggregation.Expression.$deserializeEJSON<S>
5641
6882
  | Aggregation.Expression.$mergeObjects<S>
5642
6883
  | Aggregation.Expression.$regexFind<S>
6884
+ | Aggregation.Expression.$serializeEJSON<S>
5643
6885
  | Aggregation.Expression.$setField<S>
6886
+ | Aggregation.Expression.$toObject<S>
5644
6887
  | Aggregation.Expression.$unsetField<S>;
5645
6888
  export type ResolvesToArray<S> =
5646
6889
  | ResolvesToAny<S>
5647
6890
  | ArrayFieldPath<S>
5648
6891
  | unknown[]
6892
+ | Aggregation.Accumulator.$concatArrays<S>
6893
+ | Aggregation.Accumulator.$setUnion<S>
6894
+ | Aggregation.Expression.$bottomN<S>
5649
6895
  | Aggregation.Expression.$concatArrays<S>
5650
6896
  | Aggregation.Expression.$filter<S>
5651
6897
  | Aggregation.Expression.$firstN<S>
@@ -5664,15 +6910,19 @@ export type ResolvesToArray<S> =
5664
6910
  | Aggregation.Expression.$slice<S>
5665
6911
  | Aggregation.Expression.$sortArray<S>
5666
6912
  | Aggregation.Expression.$split<S>
6913
+ | Aggregation.Expression.$toArray<S>
6914
+ | Aggregation.Expression.$topN<S>
5667
6915
  | Aggregation.Expression.$zip<S>;
5668
6916
  export type ResolvesToBinData<S> =
5669
6917
  | ResolvesToAny<S>
5670
6918
  | BinDataFieldPath<S>
5671
- | bson.Binary;
6919
+ | bson.Binary
6920
+ | Aggregation.Expression.$hash<S>;
5672
6921
  export type ResolvesToObjectId<S> =
5673
6922
  | ResolvesToAny<S>
5674
6923
  | ObjectIdFieldPath<S>
5675
6924
  | bson.ObjectId
6925
+ | Aggregation.Expression.$createObjectId<S>
5676
6926
  | Aggregation.Expression.$toObjectId<S>;
5677
6927
  export type ResolvesToBool<S> =
5678
6928
  | ResolvesToAny<S>
@@ -5751,6 +7001,7 @@ export type ResolvesToInt<S> =
5751
7001
  | Aggregation.Expression.$strLenCP<S>
5752
7002
  | Aggregation.Expression.$strcasecmp<S>
5753
7003
  | Aggregation.Expression.$subtract<S>
7004
+ | Aggregation.Expression.$subtype<S>
5754
7005
  | Aggregation.Expression.$toInt<S>
5755
7006
  | Aggregation.Expression.$week<S>
5756
7007
  | Aggregation.Expression.$year<S>;
@@ -5804,6 +7055,7 @@ export type AccumulatorOperator<S> =
5804
7055
  | Aggregation.Accumulator.$avg<S>
5805
7056
  | Aggregation.Accumulator.$bottom<S>
5806
7057
  | Aggregation.Accumulator.$bottomN<S>
7058
+ | Aggregation.Accumulator.$concatArrays<S>
5807
7059
  | Aggregation.Accumulator.$count<S>
5808
7060
  | Aggregation.Accumulator.$covariancePop<S>
5809
7061
  | Aggregation.Accumulator.$covarianceSamp<S>
@@ -5823,10 +7075,12 @@ export type AccumulatorOperator<S> =
5823
7075
  | Aggregation.Accumulator.$median<S>
5824
7076
  | Aggregation.Accumulator.$mergeObjects<S>
5825
7077
  | Aggregation.Accumulator.$min<S>
7078
+ | Aggregation.Accumulator.$minMaxScaler<S>
5826
7079
  | Aggregation.Accumulator.$minN<S>
5827
7080
  | Aggregation.Accumulator.$percentile<S>
5828
7081
  | Aggregation.Accumulator.$push<S>
5829
7082
  | Aggregation.Accumulator.$rank<S>
7083
+ | Aggregation.Accumulator.$setUnion<S>
5830
7084
  | Aggregation.Accumulator.$shift<S>
5831
7085
  | Aggregation.Accumulator.$stdDevPop<S>
5832
7086
  | Aggregation.Accumulator.$stdDevSamp<S>
@@ -5838,6 +7092,7 @@ export type Window<S> =
5838
7092
  | Aggregation.Accumulator.$avg<S>
5839
7093
  | Aggregation.Accumulator.$bottom<S>
5840
7094
  | Aggregation.Accumulator.$bottomN<S>
7095
+ | Aggregation.Accumulator.$concatArrays<S>
5841
7096
  | Aggregation.Accumulator.$count<S>
5842
7097
  | Aggregation.Accumulator.$covariancePop<S>
5843
7098
  | Aggregation.Accumulator.$covarianceSamp<S>
@@ -5856,10 +7111,12 @@ export type Window<S> =
5856
7111
  | Aggregation.Accumulator.$maxN<S>
5857
7112
  | Aggregation.Accumulator.$median<S>
5858
7113
  | Aggregation.Accumulator.$min<S>
7114
+ | Aggregation.Accumulator.$minMaxScaler<S>
5859
7115
  | Aggregation.Accumulator.$minN<S>
5860
7116
  | Aggregation.Accumulator.$percentile<S>
5861
7117
  | Aggregation.Accumulator.$push<S>
5862
7118
  | Aggregation.Accumulator.$rank<S>
7119
+ | Aggregation.Accumulator.$setUnion<S>
5863
7120
  | Aggregation.Accumulator.$shift<S>
5864
7121
  | Aggregation.Accumulator.$stdDevPop<S>
5865
7122
  | Aggregation.Accumulator.$stdDevSamp<S>
@@ -5885,6 +7142,8 @@ export type ExpressionOperator<S> =
5885
7142
  | Aggregation.Expression.$bitNot<S>
5886
7143
  | Aggregation.Expression.$bitOr<S>
5887
7144
  | Aggregation.Expression.$bitXor<S>
7145
+ | Aggregation.Expression.$bottom<S>
7146
+ | Aggregation.Expression.$bottomN<S>
5888
7147
  | Aggregation.Expression.$bsonSize<S>
5889
7148
  | Aggregation.Expression.$case<S>
5890
7149
  | Aggregation.Expression.$ceil<S>
@@ -5895,6 +7154,7 @@ export type ExpressionOperator<S> =
5895
7154
  | Aggregation.Expression.$convert<S>
5896
7155
  | Aggregation.Expression.$cos<S>
5897
7156
  | Aggregation.Expression.$cosh<S>
7157
+ | Aggregation.Expression.$createObjectId<S>
5898
7158
  | Aggregation.Expression.$dateAdd<S>
5899
7159
  | Aggregation.Expression.$dateDiff<S>
5900
7160
  | Aggregation.Expression.$dateFromParts<S>
@@ -5907,6 +7167,7 @@ export type ExpressionOperator<S> =
5907
7167
  | Aggregation.Expression.$dayOfWeek<S>
5908
7168
  | Aggregation.Expression.$dayOfYear<S>
5909
7169
  | Aggregation.Expression.$degreesToRadians<S>
7170
+ | Aggregation.Expression.$deserializeEJSON<S>
5910
7171
  | Aggregation.Expression.$divide<S>
5911
7172
  | Aggregation.Expression.$eq<S>
5912
7173
  | Aggregation.Expression.$exp<S>
@@ -5918,6 +7179,8 @@ export type ExpressionOperator<S> =
5918
7179
  | Aggregation.Expression.$getField<S>
5919
7180
  | Aggregation.Expression.$gt<S>
5920
7181
  | Aggregation.Expression.$gte<S>
7182
+ | Aggregation.Expression.$hash<S>
7183
+ | Aggregation.Expression.$hexHash<S>
5921
7184
  | Aggregation.Expression.$hour<S>
5922
7185
  | Aggregation.Expression.$ifNull<S>
5923
7186
  | Aggregation.Expression.$in<S>
@@ -5971,12 +7234,17 @@ export type ExpressionOperator<S> =
5971
7234
  | Aggregation.Expression.$round<S>
5972
7235
  | Aggregation.Expression.$rtrim<S>
5973
7236
  | Aggregation.Expression.$second<S>
7237
+ | Aggregation.Expression.$serializeEJSON<S>
5974
7238
  | Aggregation.Expression.$setDifference<S>
5975
7239
  | Aggregation.Expression.$setEquals<S>
5976
7240
  | Aggregation.Expression.$setField<S>
5977
7241
  | Aggregation.Expression.$setIntersection<S>
5978
7242
  | Aggregation.Expression.$setIsSubset<S>
5979
7243
  | Aggregation.Expression.$setUnion<S>
7244
+ | Aggregation.Expression.$sigmoid<S>
7245
+ | Aggregation.Expression.$similarityCosine<S>
7246
+ | Aggregation.Expression.$similarityDotProduct<S>
7247
+ | Aggregation.Expression.$similarityEuclidean<S>
5980
7248
  | Aggregation.Expression.$sin<S>
5981
7249
  | Aggregation.Expression.$sinh<S>
5982
7250
  | Aggregation.Expression.$size<S>
@@ -5993,10 +7261,12 @@ export type ExpressionOperator<S> =
5993
7261
  | Aggregation.Expression.$substrBytes<S>
5994
7262
  | Aggregation.Expression.$substrCP<S>
5995
7263
  | Aggregation.Expression.$subtract<S>
7264
+ | Aggregation.Expression.$subtype<S>
5996
7265
  | Aggregation.Expression.$sum<S>
5997
7266
  | Aggregation.Expression.$switch<S>
5998
7267
  | Aggregation.Expression.$tan<S>
5999
7268
  | Aggregation.Expression.$tanh<S>
7269
+ | Aggregation.Expression.$toArray<S>
6000
7270
  | Aggregation.Expression.$toBool<S>
6001
7271
  | Aggregation.Expression.$toDate<S>
6002
7272
  | Aggregation.Expression.$toDecimal<S>
@@ -6005,9 +7275,12 @@ export type ExpressionOperator<S> =
6005
7275
  | Aggregation.Expression.$toInt<S>
6006
7276
  | Aggregation.Expression.$toLong<S>
6007
7277
  | Aggregation.Expression.$toLower<S>
7278
+ | Aggregation.Expression.$toObject<S>
6008
7279
  | Aggregation.Expression.$toObjectId<S>
6009
7280
  | Aggregation.Expression.$toString<S>
6010
7281
  | Aggregation.Expression.$toUpper<S>
7282
+ | Aggregation.Expression.$top<S>
7283
+ | Aggregation.Expression.$topN<S>
6011
7284
  | Aggregation.Expression.$trim<S>
6012
7285
  | Aggregation.Expression.$trunc<S>
6013
7286
  | Aggregation.Expression.$tsIncrement<S>
@@ -6019,6 +7292,7 @@ export type ExpressionOperator<S> =
6019
7292
  | Aggregation.Expression.$zip<S>;
6020
7293
  export type ResolvesToAny<S> =
6021
7294
  | Aggregation.Expression.$arrayElemAt<S>
7295
+ | Aggregation.Expression.$bottom<S>
6022
7296
  | Aggregation.Expression.$cond<S>
6023
7297
  | Aggregation.Expression.$convert<S>
6024
7298
  | Aggregation.Expression.$first<S>
@@ -6032,7 +7306,8 @@ export type ResolvesToAny<S> =
6032
7306
  | Aggregation.Expression.$meta<S>
6033
7307
  | Aggregation.Expression.$min<S>
6034
7308
  | Aggregation.Expression.$reduce<S>
6035
- | Aggregation.Expression.$switch<S>;
7309
+ | Aggregation.Expression.$switch<S>
7310
+ | Aggregation.Expression.$top<S>;
6036
7311
  export type SwitchBranch<S> = Aggregation.Expression.$case<S>;
6037
7312
  export type FieldQuery<S> =
6038
7313
  | Aggregation.Query.$all<S>
@@ -6071,6 +7346,7 @@ export type QueryOperator<S> =
6071
7346
  | Aggregation.Query.$box<S>
6072
7347
  | Aggregation.Query.$center<S>
6073
7348
  | Aggregation.Query.$centerSphere<S>
7349
+ | Aggregation.Query.$comment<S>
6074
7350
  | Aggregation.Query.$elemMatch<S>
6075
7351
  | Aggregation.Query.$eq<S>
6076
7352
  | Aggregation.Query.$exists<S>
@@ -6111,6 +7387,8 @@ export type SearchOperator<S> =
6111
7387
  | Aggregation.Search.Facet<S>
6112
7388
  | Aggregation.Search.GeoShape<S>
6113
7389
  | Aggregation.Search.GeoWithin<S>
7390
+ | Aggregation.Search.HasAncestor<S>
7391
+ | Aggregation.Search.HasRoot<S>
6114
7392
  | Aggregation.Search.In<S>
6115
7393
  | Aggregation.Search.MoreLikeThis<S>
6116
7394
  | Aggregation.Search.Near<S>
@@ -6119,7 +7397,15 @@ export type SearchOperator<S> =
6119
7397
  | Aggregation.Search.Range<S>
6120
7398
  | Aggregation.Search.Regex<S>
6121
7399
  | Aggregation.Search.Text<S>
7400
+ | Aggregation.Search.VectorSearch<S>
6122
7401
  | Aggregation.Search.Wildcard<S>;
7402
+ export type UpdateStage<S> =
7403
+ | Aggregation.Stage.$addFields<S>
7404
+ | Aggregation.Stage.$project<S>
7405
+ | Aggregation.Stage.$replaceRoot<S>
7406
+ | Aggregation.Stage.$replaceWith<S>
7407
+ | Aggregation.Stage.$set<S>
7408
+ | Aggregation.Stage.$unset<S>;
6123
7409
  export type StageOperator<S> =
6124
7410
  | Aggregation.Stage.$addFields<S>
6125
7411
  | Aggregation.Stage.$bucket<S>
@@ -6148,10 +7434,14 @@ export type StageOperator<S> =
6148
7434
  | Aggregation.Stage.$out<S>
6149
7435
  | Aggregation.Stage.$planCacheStats<S>
6150
7436
  | Aggregation.Stage.$project<S>
7437
+ | Aggregation.Stage.$rankFusion<S>
6151
7438
  | Aggregation.Stage.$redact<S>
6152
7439
  | Aggregation.Stage.$replaceRoot<S>
6153
7440
  | Aggregation.Stage.$replaceWith<S>
7441
+ | Aggregation.Stage.$rerank<S>
6154
7442
  | Aggregation.Stage.$sample<S>
7443
+ | Aggregation.Stage.$score<S>
7444
+ | Aggregation.Stage.$scoreFusion<S>
6155
7445
  | Aggregation.Stage.$search<S>
6156
7446
  | Aggregation.Stage.$searchMeta<S>
6157
7447
  | Aggregation.Stage.$set<S>
@@ -6164,3 +7454,51 @@ export type StageOperator<S> =
6164
7454
  | Aggregation.Stage.$unset<S>
6165
7455
  | Aggregation.Stage.$unwind<S>
6166
7456
  | Aggregation.Stage.$vectorSearch<S>;
7457
+ export type InputStage<S> =
7458
+ | Aggregation.Stage.$changeStream<S>
7459
+ | Aggregation.Stage.$collStats<S>
7460
+ | Aggregation.Stage.$currentOp<S>
7461
+ | Aggregation.Stage.$documents<S>
7462
+ | Aggregation.Stage.$geoNear<S>
7463
+ | Aggregation.Stage.$indexStats<S>
7464
+ | Aggregation.Stage.$listLocalSessions<S>
7465
+ | Aggregation.Stage.$listSessions<S>
7466
+ | Aggregation.Stage.$search<S>
7467
+ | Aggregation.Stage.$searchMeta<S>
7468
+ | Aggregation.Stage.$vectorSearch<S>;
7469
+ export type OutputStage<S> =
7470
+ | Aggregation.Stage.$changeStreamSplitLargeEvent<S>
7471
+ | Aggregation.Stage.$merge<S>
7472
+ | Aggregation.Stage.$out<S>;
7473
+ export type Update<S> =
7474
+ | Aggregation.Update.$addToSet<S>
7475
+ | Aggregation.Update.$bit<S>
7476
+ | Aggregation.Update.$currentDate<S>
7477
+ | Aggregation.Update.$inc<S>
7478
+ | Aggregation.Update.$max<S>
7479
+ | Aggregation.Update.$min<S>
7480
+ | Aggregation.Update.$mul<S>
7481
+ | Aggregation.Update.$pop<S>
7482
+ | Aggregation.Update.$pull<S>
7483
+ | Aggregation.Update.$pullAll<S>
7484
+ | Aggregation.Update.$push<S>
7485
+ | Aggregation.Update.$rename<S>
7486
+ | Aggregation.Update.$set<S>
7487
+ | Aggregation.Update.$setOnInsert<S>
7488
+ | Aggregation.Update.$unset<S>;
7489
+ export type UpdateOperator<S> =
7490
+ | Aggregation.Update.$addToSet<S>
7491
+ | Aggregation.Update.$bit<S>
7492
+ | Aggregation.Update.$currentDate<S>
7493
+ | Aggregation.Update.$inc<S>
7494
+ | Aggregation.Update.$max<S>
7495
+ | Aggregation.Update.$min<S>
7496
+ | Aggregation.Update.$mul<S>
7497
+ | Aggregation.Update.$pop<S>
7498
+ | Aggregation.Update.$pull<S>
7499
+ | Aggregation.Update.$pullAll<S>
7500
+ | Aggregation.Update.$push<S>
7501
+ | Aggregation.Update.$rename<S>
7502
+ | Aggregation.Update.$set<S>
7503
+ | Aggregation.Update.$setOnInsert<S>
7504
+ | Aggregation.Update.$unset<S>;