Skip to content

Commit a82122a

Browse files
authored
feat(mongodb-constants): add missing aggregation stages and expression operators (#759)
Addresses COMPASS-6697 and subtasks: - COMPASS-6698: add $setField and $unsetField expression operators (MongoDB 5.0) - COMPASS-6699: add 18 missing trig/math operators - $acos, $acosh, $asin, $asinh, $atan, $atan2, $atanh, $cos, $cosh, $degreesToRadians, $radiansToDegrees, $rand, $round, $sampleRate, $sin, $sinh, $tan, $tanh - COMPASS-8149: add $changeStreamSplitLargeEvent stage (MongoDB 7.0) - COMPASS-8150: add $listSearchIndexes stage (MongoDB 7.0)
1 parent a4bdc1d commit a82122a

2 files changed

Lines changed: 185 additions & 0 deletions

File tree

packages/mongodb-constants/src/expression-operators.ts

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ const EXPRESSION_OPERATORS = [
1616
meta: 'expr:arith',
1717
version: '4.4.0',
1818
},
19+
{
20+
name: '$acos',
21+
value: '$acos',
22+
score: 1,
23+
meta: 'expr:trig',
24+
version: '4.2.0',
25+
},
26+
{
27+
name: '$acosh',
28+
value: '$acosh',
29+
score: 1,
30+
meta: 'expr:trig',
31+
version: '4.2.0',
32+
},
1933
{
2034
name: '$add',
2135
value: '$add',
@@ -44,6 +58,20 @@ const EXPRESSION_OPERATORS = [
4458
meta: 'expr:set',
4559
version: '2.6.0',
4660
},
61+
{
62+
name: '$asin',
63+
value: '$asin',
64+
score: 1,
65+
meta: 'expr:trig',
66+
version: '4.2.0',
67+
},
68+
{
69+
name: '$asinh',
70+
value: '$asinh',
71+
score: 1,
72+
meta: 'expr:trig',
73+
version: '4.2.0',
74+
},
4775
{
4876
name: '$arrayElemAt',
4977
value: '$arrayElemAt',
@@ -58,6 +86,27 @@ const EXPRESSION_OPERATORS = [
5886
meta: 'expr:array',
5987
version: '3.4.4',
6088
},
89+
{
90+
name: '$atan',
91+
value: '$atan',
92+
score: 1,
93+
meta: 'expr:trig',
94+
version: '4.2.0',
95+
},
96+
{
97+
name: '$atan2',
98+
value: '$atan2',
99+
score: 1,
100+
meta: 'expr:trig',
101+
version: '4.2.0',
102+
},
103+
{
104+
name: '$atanh',
105+
value: '$atanh',
106+
score: 1,
107+
meta: 'expr:trig',
108+
version: '4.2.0',
109+
},
61110
{
62111
name: '$binarySize',
63112
value: '$binarySize',
@@ -121,6 +170,20 @@ const EXPRESSION_OPERATORS = [
121170
meta: 'expr:cond',
122171
version: '2.6.0',
123172
},
173+
{
174+
name: '$cos',
175+
value: '$cos',
176+
score: 1,
177+
meta: 'expr:trig',
178+
version: '4.2.0',
179+
},
180+
{
181+
name: '$cosh',
182+
value: '$cosh',
183+
score: 1,
184+
meta: 'expr:trig',
185+
version: '4.2.0',
186+
},
124187
{
125188
name: '$dateAdd',
126189
value: '$dateAdd',
@@ -205,6 +268,13 @@ const EXPRESSION_OPERATORS = [
205268
meta: 'expr:date',
206269
version: '3.0.0',
207270
},
271+
{
272+
name: '$degreesToRadians',
273+
value: '$degreesToRadians',
274+
score: 1,
275+
meta: 'expr:trig',
276+
version: '4.2.0',
277+
},
208278
{
209279
name: '$deserializeEJSON',
210280
value: '$deserializeEJSON',
@@ -520,6 +590,20 @@ const EXPRESSION_OPERATORS = [
520590
meta: 'expr:arith',
521591
version: '3.2.0',
522592
},
593+
{
594+
name: '$radiansToDegrees',
595+
value: '$radiansToDegrees',
596+
score: 1,
597+
meta: 'expr:trig',
598+
version: '4.2.0',
599+
},
600+
{
601+
name: '$rand',
602+
value: '$rand',
603+
score: 1,
604+
meta: 'expr:misc',
605+
version: '4.4.2',
606+
},
523607
{
524608
name: '$range',
525609
value: '$range',
@@ -576,6 +660,20 @@ const EXPRESSION_OPERATORS = [
576660
meta: 'expr:array',
577661
version: '3.4.0',
578662
},
663+
{
664+
name: '$round',
665+
value: '$round',
666+
score: 1,
667+
meta: 'expr:arith',
668+
version: '4.2.0',
669+
},
670+
{
671+
name: '$sampleRate',
672+
value: '$sampleRate',
673+
score: 1,
674+
meta: 'expr:misc',
675+
version: '4.4.2',
676+
},
579677
{
580678
name: '$second',
581679
value: '$second',
@@ -604,6 +702,13 @@ const EXPRESSION_OPERATORS = [
604702
meta: 'expr:set',
605703
version: '2.6.0',
606704
},
705+
{
706+
name: '$setField',
707+
value: '$setField',
708+
score: 1,
709+
meta: 'expr:obj',
710+
version: '5.0.0',
711+
},
607712
{
608713
name: '$setIntersection',
609714
value: '$setIntersection',
@@ -653,6 +758,20 @@ const EXPRESSION_OPERATORS = [
653758
meta: 'expr:arith',
654759
version: '8.2.0',
655760
},
761+
{
762+
name: '$sin',
763+
value: '$sin',
764+
score: 1,
765+
meta: 'expr:trig',
766+
version: '4.2.0',
767+
},
768+
{
769+
name: '$sinh',
770+
value: '$sinh',
771+
score: 1,
772+
meta: 'expr:trig',
773+
version: '4.2.0',
774+
},
656775
{
657776
name: '$size',
658777
value: '$size',
@@ -746,6 +865,20 @@ const EXPRESSION_OPERATORS = [
746865
meta: 'expr:cond',
747866
version: '3.4.0',
748867
},
868+
{
869+
name: '$tan',
870+
value: '$tan',
871+
score: 1,
872+
meta: 'expr:trig',
873+
version: '4.2.0',
874+
},
875+
{
876+
name: '$tanh',
877+
value: '$tanh',
878+
score: 1,
879+
meta: 'expr:trig',
880+
version: '4.2.0',
881+
},
749882
{
750883
name: '$toHashedIndexKey',
751884
value: '$toHashedIndexKey',
@@ -809,6 +942,13 @@ const EXPRESSION_OPERATORS = [
809942
meta: 'expr:type',
810943
version: '3.4.0',
811944
},
945+
{
946+
name: '$unsetField',
947+
value: '$unsetField',
948+
score: 1,
949+
meta: 'expr:obj',
950+
version: '5.0.0',
951+
},
812952
{
813953
name: '$week',
814954
value: '$week',

packages/mongodb-constants/src/stage-operators.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,27 @@ const STAGE_OPERATORS = [
155155
startAtOperationTime: \${7:time},
156156
}`,
157157
},
158+
{
159+
name: '$changeStreamSplitLargeEvent',
160+
value: '$changeStreamSplitLargeEvent',
161+
label: '$changeStreamSplitLargeEvent',
162+
outputStage: false,
163+
fullScan: false,
164+
firstStage: false,
165+
score: 1,
166+
env: [ATLAS, ON_PREM],
167+
meta: 'stage',
168+
version: '7.0.0',
169+
apiVersions: [1],
170+
namespaces: [DATABASE],
171+
description:
172+
'Splits large change stream events that exceed 16MB into smaller fragments returned as separate events.',
173+
comment: `/**
174+
* No additional options required.
175+
*/
176+
`,
177+
snippet: '{}',
178+
},
158179
{
159180
name: '$collStats',
160181
value: '$collStats',
@@ -512,6 +533,30 @@ const STAGE_OPERATORS = [
512533
users: [
513534
{ user: '\${2:string}', db: '\${3:string}' }
514535
]
536+
}`,
537+
},
538+
{
539+
name: '$listSearchIndexes',
540+
value: '$listSearchIndexes',
541+
label: '$listSearchIndexes',
542+
outputStage: false,
543+
fullScan: false,
544+
firstStage: true,
545+
score: 1,
546+
env: [ATLAS, ON_PREM],
547+
meta: 'stage',
548+
version: '7.0.0',
549+
apiVersions: [],
550+
namespaces: [COLLECTION],
551+
description:
552+
'Returns information about existing Atlas Search and Atlas Vector Search indexes on a specified collection.',
553+
comment: `/**
554+
* name: Optional. The name of the index to return information for.
555+
* id: Optional. The id of the index to return information for.
556+
*/
557+
`,
558+
snippet: `{
559+
name: '\${1:indexName}'
515560
}`,
516561
},
517562
{

0 commit comments

Comments
 (0)