diff --git a/packages/mongodb-constants/src/filter.spec.ts b/packages/mongodb-constants/src/filter.spec.ts index 008c5045b..f1f169d74 100644 --- a/packages/mongodb-constants/src/filter.spec.ts +++ b/packages/mongodb-constants/src/filter.spec.ts @@ -208,26 +208,5 @@ describe('completer', function () { } }); }); - - it('should include $$IDX system variable gated to MongoDB 8.3+', function () { - const idx = ALL_CONSTANTS.find((c) => c.value === '$$IDX'); - expect(idx).to.exist; - expect(idx?.version).to.eq('8.3.0'); - expect(idx?.meta).to.eq('variable:system'); - }); - - it('should return $$IDX for server 8.3+ but not for older servers', function () { - const withIdx = getFilteredCompletions( - { serverVersion: '8.3.0' }, - ALL_CONSTANTS, - ).map((c) => c.value); - expect(withIdx).to.include('$$IDX'); - - const withoutIdx = getFilteredCompletions( - { serverVersion: '8.2.0' }, - ALL_CONSTANTS, - ).map((c) => c.value); - expect(withoutIdx).to.not.include('$$IDX'); - }); }); }); diff --git a/packages/mongodb-constants/src/system-variables.ts b/packages/mongodb-constants/src/system-variables.ts index c055d6cf0..2fe23abf6 100644 --- a/packages/mongodb-constants/src/system-variables.ts +++ b/packages/mongodb-constants/src/system-variables.ts @@ -56,15 +56,6 @@ const SYSTEM_VARIABLES = [ version: '3.0.0', description: 'One of the allowed results of a `$redact` expression.', }, - { - name: '$$IDX', - value: '$$IDX', - score: 1, - meta: 'variable:system', - version: '8.3.0', - description: - 'A variable that references the index of the current array element in $map, $filter, and $reduce expressions. Use arrayIndexAs to specify a custom name instead.', - }, { name: '$$PRUNE', value: '$$PRUNE', diff --git a/packages/mongodb-ts-autocomplete/src/autocompleter.spec.ts b/packages/mongodb-ts-autocomplete/src/autocompleter.spec.ts index 2713f05fd..d869a96a6 100644 --- a/packages/mongodb-ts-autocomplete/src/autocompleter.spec.ts +++ b/packages/mongodb-ts-autocomplete/src/autocompleter.spec.ts @@ -321,19 +321,6 @@ service host, so typescript wouldn't load all the dependencies. } }); - it('suggests arrayIndexAs inside $filter, $map, $reduce operators', async function () { - const operators = ['$filter', '$map', '$reduce'] as const; - for (const op of operators) { - const completions = await autocompleter.autocomplete( - `db.foo.aggregate([{ $project: { result: { ${op}: { array`, - ); - const names = completions.map((c) => c.name); - expect(names, `${op} should suggest arrayIndexAs`).to.include( - 'arrayIndexAs', - ); - } - }); - describe('getConnectionSchemaCode', function () { it('generates code for a connection', async function () { const docs = [ diff --git a/packages/mql-typescript/out/schema.d.ts b/packages/mql-typescript/out/schema.d.ts index 40f0aee74..9163ee0d2 100644 --- a/packages/mql-typescript/out/schema.d.ts +++ b/packages/mql-typescript/out/schema.d.ts @@ -1560,12 +1560,6 @@ export namespace Aggregation.Expression { */ as?: string; - /** - * A name for the variable that represents the index of the array element. Available in MongoDB 8.3+. - * If not specified, the index is available as $$IDX. - */ - arrayIndexAs?: string; - /** * 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. * If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. @@ -2132,12 +2126,6 @@ export namespace Aggregation.Expression { */ as?: ResolvesToString; - /** - * A name for the variable that represents the index of the array element. Available in MongoDB 8.3+. - * If not specified, the index is available as $$IDX. - */ - arrayIndexAs?: string; - /** * 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. */ @@ -2539,22 +2527,6 @@ export namespace Aggregation.Expression { */ initialValue: Expression; - /** - * A name for the variable that represents each element of the input array. Defaults to $$this. Available in MongoDB 8.3+. - */ - as?: string; - - /** - * A name for the variable that represents the cumulative value. Defaults to $$value. Available in MongoDB 8.3+. - */ - valueAs?: string; - - /** - * A name for the variable that represents the index of the array element. Available in MongoDB 8.3+. - * If not specified, the index is available as $$IDX. - */ - arrayIndexAs?: string; - /** * 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. * During evaluation of the in expression, two variables will be available: