From 7d510a3d6827211ea481250f50f69b6e031bace2 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Fri, 15 Mar 2024 15:09:52 -0400 Subject: [PATCH 01/14] synced tests --- .../search-index-management.spec.test.ts | 2 +- .../searchIndexIgnoresReadWriteConcern.json | 252 ++++++++++++++++++ .../searchIndexIgnoresReadWriteConcern.yml | 142 ++++++++++ 3 files changed, 395 insertions(+), 1 deletion(-) create mode 100644 test/spec/index-management/searchIndexIgnoresReadWriteConcern.json create mode 100644 test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml diff --git a/test/integration/index-management/search-index-management.spec.test.ts b/test/integration/index-management/search-index-management.spec.test.ts index f519605f690..ac8e3da9f12 100644 --- a/test/integration/index-management/search-index-management.spec.test.ts +++ b/test/integration/index-management/search-index-management.spec.test.ts @@ -3,6 +3,6 @@ import { join } from 'path'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; -describe('Search Index Management Tests (Unified)', function () { +describe.only('Search Index Management Tests (Unified)', function () { runUnifiedSuite(loadSpecTests(join('index-management'))); }); diff --git a/test/spec/index-management/searchIndexIgnoresReadWriteConcern.json b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.json new file mode 100644 index 00000000000..b0cec4c33f3 --- /dev/null +++ b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.json @@ -0,0 +1,252 @@ +{ + "description": "search index operations ignore read and write concern", + "schemaVersion": "1.4", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "uriOptions": { + "readConcernLevel": "local", + "w": 1 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "collection0" + } + } + ], + "runOnRequirements": [ + { + "minServerVersion": "7.0.0", + "topologies": [ + "replicaset", + "load-balanced", + "sharded" + ], + "serverless": "forbid" + } + ], + "tests": [ + { + "description": "createSearchIndex ignores read and write concern", + "operations": [ + { + "name": "createSearchIndex", + "object": "collection0", + "arguments": { + "model": { + "definition": { + "mappings": { + "dynamic": true + } + } + } + }, + "expectError": { + "isError": true, + "errorContains": "Search index commands are only supported with Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [ + { + "definition": { + "mappings": { + "dynamic": true + } + } + } + ], + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "createSearchIndexes ignores read and write concern", + "operations": [ + { + "name": "createSearchIndexes", + "object": "collection0", + "arguments": { + "models": [] + }, + "expectError": { + "isError": true, + "errorContains": "Search index commands are only supported with Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [], + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "dropSearchIndex ignores read and write concern", + "operations": [ + { + "name": "dropSearchIndex", + "object": "collection0", + "arguments": { + "name": "test index" + }, + "expectError": { + "isError": true, + "errorContains": "Search index commands are only supported with Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "dropSearchIndex": "collection0", + "name": "test index", + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "listSearchIndexes ignores read and write concern", + "operations": [ + { + "name": "listSearchIndexes", + "object": "collection0", + "expectError": { + "isError": true, + "errorContains": "Search index commands are only supported with Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "pipeline": [ + { + "$listSearchIndexes": {} + } + ], + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "updateSearchIndex ignores the read and write concern", + "operations": [ + { + "name": "updateSearchIndex", + "object": "collection0", + "arguments": { + "name": "test index", + "definition": {} + }, + "expectError": { + "isError": true, + "errorContains": "Search index commands are only supported with Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "updateSearchIndex": "collection0", + "name": "test index", + "definition": {}, + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml new file mode 100644 index 00000000000..8a1495b29eb --- /dev/null +++ b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml @@ -0,0 +1,142 @@ +description: "search index operations ignore read and write concern" +schemaVersion: "1.4" +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + # Set a non-default read and write concern. + uriOptions: + readConcernLevel: local + w: 1 + observeEvents: + - commandStartedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: *database0 + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: *collection0 + +runOnRequirements: + - minServerVersion: "7.0.0" + topologies: [ replicaset, load-balanced, sharded ] + serverless: forbid + +tests: + - description: "createSearchIndex ignores read and write concern" + operations: + - name: createSearchIndex + object: *collection0 + arguments: + model: { definition: &definition { mappings: { dynamic: true } } } + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + isError: true + errorContains: Search index commands are only supported with Atlas + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + createSearchIndexes: *collection0 + indexes: [ { definition: *definition } ] + $db: *database0 + # Expect no writeConcern or readConcern to be sent. + writeConcern: { $$exists: false } + readConcern: { $$exists: false } + + - description: "createSearchIndex ignores read and write concern" + operations: + - name: createSearchIndexes + object: *collection0 + arguments: + models: [] + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + isError: true + errorContains: Search index commands are only supported with Atlas + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + createSearchIndexes: *collection0 + indexes: [] + $db: *database0 + # Expect no writeConcern or readConcern to be sent. + writeConcern: { $$exists: false } + readConcern: { $$exists: false } + + - description: "dropSearchIndex ignores read and write concern" + operations: + - name: dropSearchIndex + object: *collection0 + arguments: + name: &indexName 'test index' + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + isError: true + errorContains: Search index commands are only supported with Atlas + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + dropSearchIndex: *collection0 + name: *indexName + $db: *database0 + # Expect no writeConcern or readConcern to be sent. + writeConcern: { $$exists: false } + readConcern: { $$exists: false } + + - description: "listSearchIndexes ignores read and write concern" + operations: + - name: listSearchIndexes + object: *collection0 + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + isError: true + errorContains: Search index commands are only supported with Atlas + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0 + pipeline: + - $listSearchIndexes: {} + # Expect no writeConcern or readConcern to be sent. + writeConcern: { $$exists: false } + readConcern: { $$exists: false } + + - description: "updateSearchIndex ignores the read and write concern" + operations: + - name: updateSearchIndex + object: *collection0 + arguments: + name: &indexName 'test index' + definition: &definition {} + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + isError: true + errorContains: Search index commands are only supported with Atlas + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + updateSearchIndex: *collection0 + name: *indexName + definition: *definition + $db: *database0 + # Expect no writeConcern or readConcern to be sent. + writeConcern: { $$exists: false } + readConcern: { $$exists: false } + From a1160e20f91a507a5e7286097183ea65e40bf7c5 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Tue, 19 Mar 2024 14:22:49 -0400 Subject: [PATCH 02/14] changed error message --- .../search-index-management.spec.test.ts | 2 +- .../searchIndexIgnoresReadWriteConcern.json | 10 ++++----- .../searchIndexIgnoresReadWriteConcern.yml | 22 +++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/test/integration/index-management/search-index-management.spec.test.ts b/test/integration/index-management/search-index-management.spec.test.ts index ac8e3da9f12..f519605f690 100644 --- a/test/integration/index-management/search-index-management.spec.test.ts +++ b/test/integration/index-management/search-index-management.spec.test.ts @@ -3,6 +3,6 @@ import { join } from 'path'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; -describe.only('Search Index Management Tests (Unified)', function () { +describe('Search Index Management Tests (Unified)', function () { runUnifiedSuite(loadSpecTests(join('index-management'))); }); diff --git a/test/spec/index-management/searchIndexIgnoresReadWriteConcern.json b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.json index b0cec4c33f3..edf71b7b7e4 100644 --- a/test/spec/index-management/searchIndexIgnoresReadWriteConcern.json +++ b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.json @@ -59,7 +59,7 @@ }, "expectError": { "isError": true, - "errorContains": "Search index commands are only supported with Atlas" + "errorContains": "Atlas" } } ], @@ -105,7 +105,7 @@ }, "expectError": { "isError": true, - "errorContains": "Search index commands are only supported with Atlas" + "errorContains": "Atlas" } } ], @@ -143,7 +143,7 @@ }, "expectError": { "isError": true, - "errorContains": "Search index commands are only supported with Atlas" + "errorContains": "Atlas" } } ], @@ -178,7 +178,7 @@ "object": "collection0", "expectError": { "isError": true, - "errorContains": "Search index commands are only supported with Atlas" + "errorContains": "Atlas" } } ], @@ -220,7 +220,7 @@ }, "expectError": { "isError": true, - "errorContains": "Search index commands are only supported with Atlas" + "errorContains": "Atlas" } } ], diff --git a/test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml index 8a1495b29eb..c2026b18dc6 100644 --- a/test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml +++ b/test/spec/index-management/searchIndexIgnoresReadWriteConcern.yml @@ -34,8 +34,9 @@ tests: expectError: # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. isError: true - errorContains: Search index commands are only supported with Atlas + errorContains: Atlas expectEvents: - client: *client0 events: @@ -48,17 +49,18 @@ tests: writeConcern: { $$exists: false } readConcern: { $$exists: false } - - description: "createSearchIndex ignores read and write concern" + - description: "createSearchIndexes ignores read and write concern" operations: - name: createSearchIndexes object: *collection0 - arguments: + arguments: models: [] expectError: # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. isError: true - errorContains: Search index commands are only supported with Atlas + errorContains: Atlas expectEvents: - client: *client0 events: @@ -80,8 +82,9 @@ tests: expectError: # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. isError: true - errorContains: Search index commands are only supported with Atlas + errorContains: Atlas expectEvents: - client: *client0 events: @@ -101,8 +104,9 @@ tests: expectError: # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. isError: true - errorContains: Search index commands are only supported with Atlas + errorContains: Atlas expectEvents: - client: *client0 events: @@ -125,8 +129,9 @@ tests: expectError: # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. isError: true - errorContains: Search index commands are only supported with Atlas + errorContains: Atlas expectEvents: - client: *client0 events: @@ -138,5 +143,4 @@ tests: $db: *database0 # Expect no writeConcern or readConcern to be sent. writeConcern: { $$exists: false } - readConcern: { $$exists: false } - + readConcern: { $$exists: false } \ No newline at end of file From 7aa7c865f78003a8a4c24b6feacc51f132ac99b2 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Tue, 19 Mar 2024 16:39:52 -0400 Subject: [PATCH 03/14] explicitly remove readConcern and writeConcern from ListSearchIndex helper function --- src/collection.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/collection.ts b/src/collection.ts index b6581675ca5..ad567b5db27 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1072,6 +1072,7 @@ export class Collection { ): ListSearchIndexesCursor { options = typeof indexNameOrOptions === 'object' ? indexNameOrOptions : options == null ? {} : options; + const cleanedOptions = (({ readConcern, writeConcern, ...rest }) => rest)(options); const indexName = indexNameOrOptions == null ? null @@ -1079,7 +1080,7 @@ export class Collection { ? null : indexNameOrOptions; - return new ListSearchIndexesCursor(this as TODO_NODE_3286, indexName, options); + return new ListSearchIndexesCursor(this as TODO_NODE_3286, indexName, cleanedOptions); } /** From 3c8fd8ba6f6dc4df7fdab7ad9cda993c154a5fd8 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Tue, 19 Mar 2024 16:52:14 -0400 Subject: [PATCH 04/14] added documentation and explicit removal of write/readConcern in listSearchIndexes collection helper --- src/collection.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/collection.ts b/src/collection.ts index ad567b5db27..f0eae18e86a 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1052,7 +1052,7 @@ export class Collection { /** * Returns all search indexes for the current collection. * - * @param options - The options for the list indexes operation. + * @param options - The options for the list indexes operation. This method will ignore 'readConcern' and 'writeConcern' keys if they are present in 'options' (since there is no Atlas support). * * @remarks Only available when used against a 7.0+ Atlas cluster. */ @@ -1061,7 +1061,7 @@ export class Collection { * Returns all search indexes for the current collection. * * @param name - The name of the index to search for. Only indexes with matching index names will be returned. - * @param options - The options for the list indexes operation. + * @param options - The options for the list indexes operation. This method will ignore 'readConcern' and 'writeConcern' keys if they are present in 'options' (since there is no Atlas support). * * @remarks Only available when used against a 7.0+ Atlas cluster. */ @@ -1072,7 +1072,10 @@ export class Collection { ): ListSearchIndexesCursor { options = typeof indexNameOrOptions === 'object' ? indexNameOrOptions : options == null ? {} : options; + + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ const cleanedOptions = (({ readConcern, writeConcern, ...rest }) => rest)(options); + const indexName = indexNameOrOptions == null ? null From 27c38ddf734e7ba1af770ae53e5a56d3708b498b Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Wed, 20 Mar 2024 15:54:52 -0400 Subject: [PATCH 05/14] added in custom transaction unified test --- ...rch-index-management-with-transaction.json | 263 ++++++++++++++++++ .../search-index-management.test.ts | 8 + 2 files changed, 271 insertions(+) create mode 100644 test/integration/index-management/node-specific/search-index-management-with-transaction.json create mode 100644 test/integration/index-management/search-index-management.test.ts diff --git a/test/integration/index-management/node-specific/search-index-management-with-transaction.json b/test/integration/index-management/node-specific/search-index-management-with-transaction.json new file mode 100644 index 00000000000..d1c96489a6e --- /dev/null +++ b/test/integration/index-management/node-specific/search-index-management-with-transaction.json @@ -0,0 +1,263 @@ +{ + "description": "when in a transaction, search index operations ignore read and write concern", + "schemaVersion": "1.4", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "uriOptions": { + "readConcernLevel": "local", + "w": 1 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "collection0" + } + } + ], + "runOnRequirements": [ + { + "minServerVersion": "7.0.0", + "topologies": [ + "replicaset", + "load-balanced", + "sharded" + ], + "serverless": "forbid" + } + ], + "tests": [ + { + "description": "when in a transaction, createSearchIndex ignores read and write concern", + "operations": [ + { + "name": "createSearchIndex", + "object": "collection0", + "arguments": { + "session": "session0", + "model": { + "definition": { + "mappings": { + "dynamic": true + } + } + } + }, + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [ + { + "definition": { + "mappings": { + "dynamic": true + } + } + } + ], + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "when in a transaction, createSearchIndexes ignores read and write concern", + "operations": [ + { + "name": "createSearchIndexes", + "object": "collection0", + "arguments": { + "session": "session0", + "models": [] + }, + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [], + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "when in a transaction, dropSearchIndex ignores read and write concern", + "operations": [ + { + "name": "dropSearchIndex", + "object": "collection0", + "arguments": { + "session": "session0", + "name": "test index" + }, + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "dropSearchIndex": "collection0", + "name": "test index", + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "when in a transaction, listSearchIndexes ignores read and write concern", + "operations": [ + { + "name": "listSearchIndexes", + "object": "collection0", + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "pipeline": [ + { + "$listSearchIndexes": {} + } + ], + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "when in a transaction, updateSearchIndex ignores the read and write concern", + "operations": [ + { + "name": "updateSearchIndex", + "object": "collection0", + "arguments": { + "session": "session0", + "name": "test index", + "definition": {} + }, + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "updateSearchIndex": "collection0", + "name": "test index", + "definition": {}, + "$db": "database0", + "writeConcern": { + "$$exists": false + }, + "readConcern": { + "$$exists": false + } + } + } + } + ] + } + ] + } + ] + } + \ No newline at end of file diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts new file mode 100644 index 00000000000..0a68c958c7d --- /dev/null +++ b/test/integration/index-management/search-index-management.test.ts @@ -0,0 +1,8 @@ +import { join } from 'path'; + +import { loadSpecTests } from '../../spec'; +import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; + +describe('Search Index Management Tests (Node Specific)', function () { + runUnifiedSuite(loadSpecTests('../integration/index-management/node-specific')); +}); From a82af7e808aafc000943b0147878203535ff0f72 Mon Sep 17 00:00:00 2001 From: Aditi Khare <106987683+aditi-khare-mongoDB@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:56:08 -0400 Subject: [PATCH 06/14] Rename search-index-management-with-transaction.json to searchIndexIgnoresReadWriteConcern-with-transaction.json Change to more descriptive file name --- ...=> searchIndexIgnoresReadWriteConcern-with-transaction.json} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename test/integration/index-management/node-specific/{search-index-management-with-transaction.json => searchIndexIgnoresReadWriteConcern-with-transaction.json} (99%) diff --git a/test/integration/index-management/node-specific/search-index-management-with-transaction.json b/test/integration/index-management/node-specific/searchIndexIgnoresReadWriteConcern-with-transaction.json similarity index 99% rename from test/integration/index-management/node-specific/search-index-management-with-transaction.json rename to test/integration/index-management/node-specific/searchIndexIgnoresReadWriteConcern-with-transaction.json index d1c96489a6e..61040c37fd3 100644 --- a/test/integration/index-management/node-specific/search-index-management-with-transaction.json +++ b/test/integration/index-management/node-specific/searchIndexIgnoresReadWriteConcern-with-transaction.json @@ -260,4 +260,4 @@ } ] } - \ No newline at end of file + From 7cc6072a5121caac2d3f7aabffa725e556a17dd1 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Wed, 20 Mar 2024 16:01:24 -0400 Subject: [PATCH 07/14] lint fix and requested changes --- src/collection.ts | 2 +- .../index-management/search-index-management.test.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/collection.ts b/src/collection.ts index f0eae18e86a..1a762d705fe 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1074,7 +1074,7 @@ export class Collection { typeof indexNameOrOptions === 'object' ? indexNameOrOptions : options == null ? {} : options; /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ - const cleanedOptions = (({ readConcern, writeConcern, ...rest }) => rest)(options); + const { readConcern, writeConcern, ...cleanedOptions } = options; const indexName = indexNameOrOptions == null diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts index 0a68c958c7d..04a43323e93 100644 --- a/test/integration/index-management/search-index-management.test.ts +++ b/test/integration/index-management/search-index-management.test.ts @@ -1,5 +1,3 @@ -import { join } from 'path'; - import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; From 59ed066eb97cf0127190128d64a2908c2b557677 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Wed, 20 Mar 2024 16:14:17 -0400 Subject: [PATCH 08/14] omit readconcern and writeConcern --- src/collection.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/collection.ts b/src/collection.ts index 1a762d705fe..4e2fe6574f1 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1052,30 +1052,32 @@ export class Collection { /** * Returns all search indexes for the current collection. * - * @param options - The options for the list indexes operation. This method will ignore 'readConcern' and 'writeConcern' keys if they are present in 'options' (since there is no Atlas support). + * @param options - The options for the list indexes operation. * * @remarks Only available when used against a 7.0+ Atlas cluster. */ - listSearchIndexes(options?: ListSearchIndexesOptions): ListSearchIndexesCursor; + listSearchIndexes( + options?: Omit + ): ListSearchIndexesCursor; /** * Returns all search indexes for the current collection. * * @param name - The name of the index to search for. Only indexes with matching index names will be returned. - * @param options - The options for the list indexes operation. This method will ignore 'readConcern' and 'writeConcern' keys if they are present in 'options' (since there is no Atlas support). + * @param options - The options for the list indexes operation. * * @remarks Only available when used against a 7.0+ Atlas cluster. */ - listSearchIndexes(name: string, options?: ListSearchIndexesOptions): ListSearchIndexesCursor; + listSearchIndexes( + name: string, + options?: Omit + ): ListSearchIndexesCursor; listSearchIndexes( indexNameOrOptions?: string | ListSearchIndexesOptions, - options?: ListSearchIndexesOptions + options?: Omit ): ListSearchIndexesCursor { options = typeof indexNameOrOptions === 'object' ? indexNameOrOptions : options == null ? {} : options; - /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ - const { readConcern, writeConcern, ...cleanedOptions } = options; - const indexName = indexNameOrOptions == null ? null @@ -1083,7 +1085,7 @@ export class Collection { ? null : indexNameOrOptions; - return new ListSearchIndexesCursor(this as TODO_NODE_3286, indexName, cleanedOptions); + return new ListSearchIndexesCursor(this as TODO_NODE_3286, indexName, options); } /** From e2a863f89c21484f54f78f88b2f86397d442e318 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Mon, 25 Mar 2024 14:07:14 -0400 Subject: [PATCH 09/14] temporary transaction tests --- ...oresReadWriteConcern-with-transaction.json | 263 ------------------ .../search-index-management.test.ts | 52 +++- 2 files changed, 48 insertions(+), 267 deletions(-) delete mode 100644 test/integration/index-management/node-specific/searchIndexIgnoresReadWriteConcern-with-transaction.json diff --git a/test/integration/index-management/node-specific/searchIndexIgnoresReadWriteConcern-with-transaction.json b/test/integration/index-management/node-specific/searchIndexIgnoresReadWriteConcern-with-transaction.json deleted file mode 100644 index 61040c37fd3..00000000000 --- a/test/integration/index-management/node-specific/searchIndexIgnoresReadWriteConcern-with-transaction.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "description": "when in a transaction, search index operations ignore read and write concern", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "7.0.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "tests": [ - { - "description": "when in a transaction, createSearchIndex ignores read and write concern", - "operations": [ - { - "name": "createSearchIndex", - "object": "collection0", - "arguments": { - "session": "session0", - "model": { - "definition": { - "mappings": { - "dynamic": true - } - } - } - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "mappings": { - "dynamic": true - } - } - } - ], - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "when in a transaction, createSearchIndexes ignores read and write concern", - "operations": [ - { - "name": "createSearchIndexes", - "object": "collection0", - "arguments": { - "session": "session0", - "models": [] - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [], - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "when in a transaction, dropSearchIndex ignores read and write concern", - "operations": [ - { - "name": "dropSearchIndex", - "object": "collection0", - "arguments": { - "session": "session0", - "name": "test index" - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "dropSearchIndex": "collection0", - "name": "test index", - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "when in a transaction, listSearchIndexes ignores read and write concern", - "operations": [ - { - "name": "listSearchIndexes", - "object": "collection0", - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$listSearchIndexes": {} - } - ], - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "when in a transaction, updateSearchIndex ignores the read and write concern", - "operations": [ - { - "name": "updateSearchIndex", - "object": "collection0", - "arguments": { - "session": "session0", - "name": "test index", - "definition": {} - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "updateSearchIndex": "collection0", - "name": "test index", - "definition": {}, - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - } - ] - } - diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts index 04a43323e93..ada2fb54927 100644 --- a/test/integration/index-management/search-index-management.test.ts +++ b/test/integration/index-management/search-index-management.test.ts @@ -1,6 +1,50 @@ -import { loadSpecTests } from '../../spec'; -import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; +import { expect } from 'chai'; -describe('Search Index Management Tests (Node Specific)', function () { - runUnifiedSuite(loadSpecTests('../integration/index-management/node-specific')); +import type { Collection, CommandStartedEvent, MongoClient } from '../../mongodb'; + +describe('Search Index Management Integration Tests', function () { + describe('read concern and write concern ', function () { + context('when operation is run withTransaction', function () { + let client: MongoClient; + let collection: Collection; + let commandStartedEvents: CommandStartedEvent[]; + + beforeEach(async function () { + client = this.configuration.newClient({}, { monitorCommands: true }); + await client.connect(); + collection = client.db('client').collection('searchIndexManagement'); + commandStartedEvents = []; + client.on('commandStarted', e => commandStartedEvents.push(e)); + }); + + afterEach(async function () { + await client.close(); + }); + + context('when operation is listSearchIndexes', function () { + it('should not include write concern or read concern in command', async function () { + client.withSession(session => { + return session.withTransaction( + async () => { + expect(session.transaction.isStarting).to.equal(true); + expect(session.transaction.isActive).to.equal(true); + try { + const res = collection.listSearchIndexes({ session }); + const arrayedRes = await res.toArray(); + console.log(arrayedRes); + } catch (e) { + expect(e.errmsg).to.match(/^.*Atlas.*$/); + } finally { + expect(commandStartedEvents[0]).to.exist; + expect(commandStartedEvents[0].command.readConcern).to.not.exist; + expect(commandStartedEvents[0].command.writeConcern).to.not.exist; + } + }, + { readConcern: 'local', writeConcern: { w: 1 } } + ); + }); + }); + }); + }); + }); }); From d7340a30561f7e5635c03ca17080f753a6b4b9db Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Mon, 25 Mar 2024 15:35:55 -0400 Subject: [PATCH 10/14] added ttests to skip in NODE-6047 --- .../search-index-management.test.ts | 110 ++++++++++++------ 1 file changed, 72 insertions(+), 38 deletions(-) diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts index ada2fb54927..28649446d81 100644 --- a/test/integration/index-management/search-index-management.test.ts +++ b/test/integration/index-management/search-index-management.test.ts @@ -1,50 +1,84 @@ import { expect } from 'chai'; -import type { Collection, CommandStartedEvent, MongoClient } from '../../mongodb'; +import { type Collection, type CommandStartedEvent, type MongoClient } from '../../mongodb'; describe('Search Index Management Integration Tests', function () { describe('read concern and write concern ', function () { - context('when operation is run withTransaction', function () { - let client: MongoClient; - let collection: Collection; - let commandStartedEvents: CommandStartedEvent[]; + let client: MongoClient; + let collection: Collection; + let commandStartedEvents: CommandStartedEvent[]; - beforeEach(async function () { - client = this.configuration.newClient({}, { monitorCommands: true }); - await client.connect(); - collection = client.db('client').collection('searchIndexManagement'); - commandStartedEvents = []; - client.on('commandStarted', e => commandStartedEvents.push(e)); - }); + beforeEach(async function () { + client = this.configuration.newClient({}, { monitorCommands: true }); + await client.connect(); + collection = client.db('client').collection('searchIndexManagement'); + commandStartedEvents = []; + client.on('commandStarted', e => commandStartedEvents.push(e)); + }); + + afterEach(async function () { + await client.close(); + }); + + context('when listSearchIndexes operation is run withTransaction', function () { + it.skip('should not include write concern or read concern in command', async function () { + await client.withSession(session => { + return session.withTransaction( + async () => { + expect(session.transaction.isStarting).to.equal(true); + expect(session.transaction.isActive).to.equal(true); + try { + const res = collection.listSearchIndexes({ session }); + await res.toArray(); + } catch (e) { + expect(e.errmsg).to.match(/^.*Atlas.*$/); + } finally { + expect(commandStartedEvents[0]).to.exist; + expect(commandStartedEvents[0].command.readConcern).to.not.exist; + expect(commandStartedEvents[0].command.writeConcern).to.not.exist; + } + }, + { readConcern: 'local', writeConcern: { w: 1 } } + ); + }); + }).skipReason = + 'TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers'; + }); - afterEach(async function () { - await client.close(); - }); + context('when listSearchIndexes operation is run with causalConsistency', function () { + it.skip('should not include write concern or read concern in command', async function () { + await client.withSession({ causalConsistency: true }, async session => { + try { + const res = collection.listSearchIndexes({ session }); + await res.toArray(); + } catch (e) { + expect(e.errmsg).to.match(/^.*Atlas.*$/); + } finally { + expect(commandStartedEvents[0]).to.exist; + expect(commandStartedEvents[0].command.readConcern).to.not.exist; + expect(commandStartedEvents[0].command.writeConcern).to.not.exist; + } + }); + }).skipReason = + 'TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers'; + }); - context('when operation is listSearchIndexes', function () { - it('should not include write concern or read concern in command', async function () { - client.withSession(session => { - return session.withTransaction( - async () => { - expect(session.transaction.isStarting).to.equal(true); - expect(session.transaction.isActive).to.equal(true); - try { - const res = collection.listSearchIndexes({ session }); - const arrayedRes = await res.toArray(); - console.log(arrayedRes); - } catch (e) { - expect(e.errmsg).to.match(/^.*Atlas.*$/); - } finally { - expect(commandStartedEvents[0]).to.exist; - expect(commandStartedEvents[0].command.readConcern).to.not.exist; - expect(commandStartedEvents[0].command.writeConcern).to.not.exist; - } - }, - { readConcern: 'local', writeConcern: { w: 1 } } - ); - }); + context('when listSearchIndexes operation is run with snapshot on', function () { + it.skip('should not include write concern or read concern in command', async function () { + await client.withSession({ snapshot: true }, async session => { + try { + const res = collection.listSearchIndexes({ session }); + await res.toArray(); + } catch (e) { + expect(e.errmsg).to.match(/^.*Atlas.*$/); + } finally { + expect(commandStartedEvents[0]).to.exist; + expect(commandStartedEvents[0].command.readConcern).to.not.exist; + expect(commandStartedEvents[0].command.writeConcern).to.not.exist; + } }); - }); + }).skipReason = + 'TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers'; }); }); }); From fa9d356048ae4620b7b3b6c4a546ed4259f7cb09 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Fri, 5 Apr 2024 11:47:58 -0400 Subject: [PATCH 11/14] flipped assertions and fixed test logic --- .../search-index-management.test.ts | 112 ++++++++++-------- 1 file changed, 64 insertions(+), 48 deletions(-) diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts index 28649446d81..8ba8244cde0 100644 --- a/test/integration/index-management/search-index-management.test.ts +++ b/test/integration/index-management/search-index-management.test.ts @@ -21,64 +21,80 @@ describe('Search Index Management Integration Tests', function () { }); context('when listSearchIndexes operation is run withTransaction', function () { - it.skip('should not include write concern or read concern in command', async function () { - await client.withSession(session => { - return session.withTransaction( - async () => { - expect(session.transaction.isStarting).to.equal(true); - expect(session.transaction.isActive).to.equal(true); - try { - const res = collection.listSearchIndexes({ session }); - await res.toArray(); - } catch (e) { - expect(e.errmsg).to.match(/^.*Atlas.*$/); - } finally { - expect(commandStartedEvents[0]).to.exist; - expect(commandStartedEvents[0].command.readConcern).to.not.exist; - expect(commandStartedEvents[0].command.writeConcern).to.not.exist; - } - }, - { readConcern: 'local', writeConcern: { w: 1 } } - ); - }); - }).skipReason = - 'TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers'; + // TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers + it('should include write concern or read concern in command - TODO(NODE-6047)', { + metadata: { + requires: { + topology: '!single', + mongodb: '>=7.0', + serverless: 'forbid' + } + }, + test: async function () { + let res; + await client.withSession(async session => { + await session + .withTransaction( + async function (session) { + res = collection.listSearchIndexes({ session }); + await res.toArray(); + }, + { readConcern: 'local', writeConcern: { w: 1 } } + ) + .catch(e => e); + // expect(e.errmsg).to.match(/^.*Atlas.*$/) - uncomment after NODE-6047 + expect(commandStartedEvents[0]).to.exist; + // flip assertion after NODE-6047 implementation + expect(commandStartedEvents[0]?.command?.readConcern).to.exist; + expect(commandStartedEvents[0]?.command?.writeConcern).to.not.exist; + }); + } + }); }); context('when listSearchIndexes operation is run with causalConsistency', function () { - it.skip('should not include write concern or read concern in command', async function () { - await client.withSession({ causalConsistency: true }, async session => { - try { + it('should not include write concern or read concern in command', { + metadata: { + requires: { + topology: '!single', + mongodb: '>=7.0', + serverless: 'forbid' + } + }, + test: async function () { + await client.withSession({ causalConsistency: true }, async session => { const res = collection.listSearchIndexes({ session }); - await res.toArray(); - } catch (e) { - expect(e.errmsg).to.match(/^.*Atlas.*$/); - } finally { + await res.toArray().catch(e => expect(e.errmsg).to.match(/^.*Atlas.*$/)); expect(commandStartedEvents[0]).to.exist; - expect(commandStartedEvents[0].command.readConcern).to.not.exist; - expect(commandStartedEvents[0].command.writeConcern).to.not.exist; - } - }); - }).skipReason = - 'TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers'; + expect(commandStartedEvents[0]?.command?.readConcern).to.not.exist; + expect(commandStartedEvents[0]?.command?.writeConcern).to.not.exist; + }); + } + }); }); context('when listSearchIndexes operation is run with snapshot on', function () { - it.skip('should not include write concern or read concern in command', async function () { - await client.withSession({ snapshot: true }, async session => { - try { + // TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers + it('should include write concern or read concern in command - TODO(NODE-6047)', { + metadata: { + requires: { + topology: ['replicaset', 'sharded'], + mongodb: '>=7.0', + serverless: 'forbid' + } + }, + test: async function () { + await client.withSession({ snapshot: true }, async session => { const res = collection.listSearchIndexes({ session }); - await res.toArray(); - } catch (e) { - expect(e.errmsg).to.match(/^.*Atlas.*$/); - } finally { + await res.toArray().catch(e => e); + // expect(e.errmsg).to.match(/^.*Atlas.*$/) - uncomment after NODE-6047 expect(commandStartedEvents[0]).to.exist; - expect(commandStartedEvents[0].command.readConcern).to.not.exist; - expect(commandStartedEvents[0].command.writeConcern).to.not.exist; - } - }); - }).skipReason = - 'TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers'; + // flip assertion after NODE-6047 implementation + expect(commandStartedEvents[0]?.command?.readConcern).to.exist; + expect(commandStartedEvents[0]?.command?.writeConcern).to.not.exist; + }); + } + }); }); }); }); From 9111fdcae0c613abea903544113b674ce51faa8b Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Fri, 5 Apr 2024 15:28:57 -0400 Subject: [PATCH 12/14] fixed error assertions --- .../index-management/search-index-management.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts index 8ba8244cde0..a94aae9c6eb 100644 --- a/test/integration/index-management/search-index-management.test.ts +++ b/test/integration/index-management/search-index-management.test.ts @@ -33,7 +33,7 @@ describe('Search Index Management Integration Tests', function () { test: async function () { let res; await client.withSession(async session => { - await session + const error = await session .withTransaction( async function (session) { res = collection.listSearchIndexes({ session }); @@ -42,7 +42,7 @@ describe('Search Index Management Integration Tests', function () { { readConcern: 'local', writeConcern: { w: 1 } } ) .catch(e => e); - // expect(e.errmsg).to.match(/^.*Atlas.*$/) - uncomment after NODE-6047 + expect(error.errmsg).to.match(/^.*Atlas.*$/); expect(commandStartedEvents[0]).to.exist; // flip assertion after NODE-6047 implementation expect(commandStartedEvents[0]?.command?.readConcern).to.exist; @@ -86,8 +86,8 @@ describe('Search Index Management Integration Tests', function () { test: async function () { await client.withSession({ snapshot: true }, async session => { const res = collection.listSearchIndexes({ session }); - await res.toArray().catch(e => e); - // expect(e.errmsg).to.match(/^.*Atlas.*$/) - uncomment after NODE-6047 + const error = await res.toArray().catch(e => e); + expect(error.errmsg).to.match(/^.*snapshot.*$/); expect(commandStartedEvents[0]).to.exist; // flip assertion after NODE-6047 implementation expect(commandStartedEvents[0]?.command?.readConcern).to.exist; From 79600b0160f908d24cc0d569ef8eae009305dcc9 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Fri, 5 Apr 2024 16:12:48 -0400 Subject: [PATCH 13/14] removed extraneous test - not relevant anymore --- .../search-index-management.test.ts | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts index a94aae9c6eb..1c191f79517 100644 --- a/test/integration/index-management/search-index-management.test.ts +++ b/test/integration/index-management/search-index-management.test.ts @@ -20,38 +20,6 @@ describe('Search Index Management Integration Tests', function () { await client.close(); }); - context('when listSearchIndexes operation is run withTransaction', function () { - // TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers - it('should include write concern or read concern in command - TODO(NODE-6047)', { - metadata: { - requires: { - topology: '!single', - mongodb: '>=7.0', - serverless: 'forbid' - } - }, - test: async function () { - let res; - await client.withSession(async session => { - const error = await session - .withTransaction( - async function (session) { - res = collection.listSearchIndexes({ session }); - await res.toArray(); - }, - { readConcern: 'local', writeConcern: { w: 1 } } - ) - .catch(e => e); - expect(error.errmsg).to.match(/^.*Atlas.*$/); - expect(commandStartedEvents[0]).to.exist; - // flip assertion after NODE-6047 implementation - expect(commandStartedEvents[0]?.command?.readConcern).to.exist; - expect(commandStartedEvents[0]?.command?.writeConcern).to.not.exist; - }); - } - }); - }); - context('when listSearchIndexes operation is run with causalConsistency', function () { it('should not include write concern or read concern in command', { metadata: { From 259863a97284038a8f4aee6273364b6947ebd26a Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Wed, 10 Apr 2024 11:34:36 -0400 Subject: [PATCH 14/14] update ListSearchIndexOptions --- src/collection.ts | 11 +++-------- src/cursor/list_search_indexes_cursor.ts | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/collection.ts b/src/collection.ts index b7955027a60..994e151b3b5 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1056,9 +1056,7 @@ export class Collection { * * @remarks Only available when used against a 7.0+ Atlas cluster. */ - listSearchIndexes( - options?: Omit - ): ListSearchIndexesCursor; + listSearchIndexes(options?: ListSearchIndexesOptions): ListSearchIndexesCursor; /** * Returns all search indexes for the current collection. * @@ -1067,13 +1065,10 @@ export class Collection { * * @remarks Only available when used against a 7.0+ Atlas cluster. */ - listSearchIndexes( - name: string, - options?: Omit - ): ListSearchIndexesCursor; + listSearchIndexes(name: string, options?: ListSearchIndexesOptions): ListSearchIndexesCursor; listSearchIndexes( indexNameOrOptions?: string | ListSearchIndexesOptions, - options?: Omit + options?: ListSearchIndexesOptions ): ListSearchIndexesCursor { options = typeof indexNameOrOptions === 'object' ? indexNameOrOptions : options == null ? {} : options; diff --git a/src/cursor/list_search_indexes_cursor.ts b/src/cursor/list_search_indexes_cursor.ts index bf5a0b56120..cfe1358f725 100644 --- a/src/cursor/list_search_indexes_cursor.ts +++ b/src/cursor/list_search_indexes_cursor.ts @@ -3,7 +3,7 @@ import type { AggregateOptions } from '../operations/aggregate'; import { AggregationCursor } from './aggregation_cursor'; /** @public */ -export type ListSearchIndexesOptions = AggregateOptions; +export type ListSearchIndexesOptions = Omit; /** @public */ export class ListSearchIndexesCursor extends AggregationCursor<{ name: string }> {