From 59d54ffcb837b2b3401f9aa7d08f15d8db443e7a Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 16 May 2023 11:47:15 -0600 Subject: [PATCH 01/21] add index management spec tests --- source/index-management/index-management.rst | 166 ++++++++++++++++++ .../tests/createSearchIndex.json | 114 ++++++++++++ .../tests/createSearchIndex.yml | 57 ++++++ .../tests/createSearchIndexes.json | 147 ++++++++++++++++ .../tests/createSearchIndexes.yml | 73 ++++++++ .../tests/dropSearchIndexes.json | 71 ++++++++ .../tests/dropSearchIndexes.yml | 38 ++++ .../tests/listSearchIndexes.json | 155 ++++++++++++++++ .../tests/listSearchIndexes.yml | 81 +++++++++ .../tests/updateSearchIndex.json | 73 ++++++++ .../tests/updateSearchIndex.yml | 40 +++++ 11 files changed, 1015 insertions(+) create mode 100644 source/index-management/tests/createSearchIndex.json create mode 100644 source/index-management/tests/createSearchIndex.yml create mode 100644 source/index-management/tests/createSearchIndexes.json create mode 100644 source/index-management/tests/createSearchIndexes.yml create mode 100644 source/index-management/tests/dropSearchIndexes.json create mode 100644 source/index-management/tests/dropSearchIndexes.yml create mode 100644 source/index-management/tests/listSearchIndexes.json create mode 100644 source/index-management/tests/listSearchIndexes.yml create mode 100644 source/index-management/tests/updateSearchIndex.json create mode 100644 source/index-management/tests/updateSearchIndex.yml diff --git a/source/index-management/index-management.rst b/source/index-management/index-management.rst index dec5d628a6..7ab2fad4af 100644 --- a/source/index-management/index-management.rst +++ b/source/index-management/index-management.rst @@ -852,6 +852,172 @@ Example:: > a [ "_id_", "ty_1", "l_2dsphere", "ts_1" ] +-------------- +Search Indexes +-------------- + +Server 7.0 introduced three new server commands and a new aggregation stage to facilitate management of search indexes. Drivers MUST provide +an API similar to the existing index management API specifically for search indexes. + +Search Index Management Helper Options +-------------------------------------- + +There are currently no supported options for any of the search index management commands. To future proof +drivers implementations so that any options added in the future do not constitute a breaking change to drivers, +empty options structs have been added as placeholders. If a driver's language has a mechanism to add options +in a non-breaking manner (i.e., method overloading) drivers MAY omit the empty options structs from their +search index management helpers. + +``listSearchIndexes`` is implemented using an aggregation pipeline. The list helper MUST support a driver's aggregation +options. Drivers MAY combine the aggregation options with +any future ``listSearchIndexes`` stage options, if that is idiomatic for a driver's language. + +Notes +----- + +The search index commands are asynchronous and return from the server before the index is successfully updated / created. +In order to determine when an index has been created / updated, users are expected to run the ``listSearchIndexes`` repeatedly +until index changes appear. + +An example, from Javascript: + +.. code:: typescript + + const name = await collection.createSearchIndex({ definition: { ... fill out definition } }) + while (!(await collection.listSearchIndexes({ name }).hasNext())) { + await setTimeout(1000); + } + +Common Interfaces +----------------- + +.. code:: typescript + + interface SearchIndexModel { + // Returns the definition for this index. + definition: Document; + + // Returns the name for this index, if present. + name: Optional; + } + +Standard API for Search Indexes +------------------------------- + +.. code:: typescript + + interface Collection { + /** + * Convenience method for creating a single search index. + * + * @return The name of the created search index + * @note Drivers MAY opt to implement this method signature, the signature that + * takes an SearchIndexModel as a parameter, or for those languages with method + * overloading MAY decide to implement both. + */ + createSearchIndex(name: String, definition: Document, options: Optional): String; + + /** + * Convenience method for creating a single index. + * + * @return The name of the created search index + * + * @note Drivers MAY opt to implement this method signature, the signature that + * takes an name and a definition as parameters, or for those languages with method + * overloading MAY decide to implement both. + */ + createSearchIndex(model: SearchIndexModel, options: Optional): String; + + /** + * Creates multiple search indexes on the collection. + * + * @return An iterable of the newly created index names. + */ + createSearchIndexes(models: Iterable, options: CreateSearchIndexOptions): Iterable ; + + /** + * Updates the search index with the given name to use the provided + * definition. + */ + updateSearchIndex(name: String, definition: Document, options: Optional): void; + + /** + * Drops the search index with the given name. + */ + dropSearchIndex(name: String, options: Optional): void; + + /** + * Gets index information for all search indexes in the collection. + */ + listSearchIndexes(name: Optional, aggregationOptions: Optional, listIndexOptions: Optional): Cursor<{ name: String }>; + } + +Index View API for Search Indexes +--------------------------------- + +.. code:: typescript + + interface Collection { + /** + * Returns the search index view for this collection. + */ + searchIndexes(options: Optional): SearchIndexView; + } + + interface SearchIndexView extends Iterable { + /** + * Enumerates the index information for all indexes in the collection. This should be + * implemented as described in the :ref:`Enumerate Indexes` section, although the naming + * requirement is dropped in favor of the driver language standard for handling iteration + * over a sequence of objects. + * + * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst + * + * @note For drivers that cannot make the IndexView iterable, they MUST implement a list + * method. See below. + */ + iterator(): Iterator<{ name: string }>; + + /** + * For drivers that cannot make SearchIndexView iterable, they MUST implement this method to + * return a list of indexes. In the case of async drivers, this MAY return a Future + * or language/implementation equivalent. + */ + list(): Cursor<{ name: String }>; + + /** + * This is a convenience method for creating a single index. + * + * @return The name of the created index. + * + * @note Drivers MAY opt to implement this method signature, the signature that + * takes an IndexModel as a parameter, or for those languages with method + * overloading MAY decide to implement both. + * + * @note Drivers MAY combine the two options types into a single one. If the options are + * explicitly typed, the combined options type MUST be named CreateOneIndexOptions or an acceptable + * variation. + */ + createOne(definition: SearchIndexDefinition, options: CreateSearchIndexOptions): String; + + /** + * Creates multiple search indexes in the collection. + * + * @return The names of the created indexes. + */ + createMany(models: Iterable, options: CreateSearchIndexOptions): Iterable; + + /** + * Drops a single search index from the collection by the index name. + */ + dropOne(name: String, options: DropSearchIndexOptions): Result; + + /** + * Updates a single search index from the collection by the index name. + */ + updateOne(name: String, options: UpdateSearchIndexOptions): Result; + } + --------- Q & A --------- diff --git a/source/index-management/tests/createSearchIndex.json b/source/index-management/tests/createSearchIndex.json new file mode 100644 index 0000000000..56b6593982 --- /dev/null +++ b/source/index-management/tests/createSearchIndex.json @@ -0,0 +1,114 @@ +{ + "description": "createSearchIndex convenience helper", + "schemaVersion": "1.10", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "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": "no name provided for an index definition", + "operations": [ + { + "name": "createSearchIndex", + "object": "collection0", + "arguments": { + "definition": { + "definition": {} + } + }, + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [ + { + "definition": {} + } + ] + } + } + } + ] + } + ] + }, + { + "description": "name provided for an index definition", + "operations": [ + { + "name": "createSearchIndex", + "object": "collection0", + "arguments": { + "definition": { + "definition": {}, + "name": "test index" + } + }, + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [ + { + "definition": {}, + "name": "test index" + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/source/index-management/tests/createSearchIndex.yml b/source/index-management/tests/createSearchIndex.yml new file mode 100644 index 0000000000..b9fa6cbf90 --- /dev/null +++ b/source/index-management/tests/createSearchIndex.yml @@ -0,0 +1,57 @@ +description: "createSearchIndex convenience helper" +schemaVersion: "1.10" +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + 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: "no name provided for an index definition" + operations: + - name: createSearchIndex + object: *collection0 + arguments: + definition: { definition: {} } + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + createSearchIndexes: *collection0 + indexes: [ { definition: {} } ] + + - description: "name provided for an index definition" + operations: + - name: createSearchIndex + object: *collection0 + arguments: + definition: { definition: {}, name: 'test index' } + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + createSearchIndexes: *collection0 + indexes: [ { definition: {}, name: 'test index' } ] + + + \ No newline at end of file diff --git a/source/index-management/tests/createSearchIndexes.json b/source/index-management/tests/createSearchIndexes.json new file mode 100644 index 0000000000..a47b68e3cb --- /dev/null +++ b/source/index-management/tests/createSearchIndexes.json @@ -0,0 +1,147 @@ +{ + "description": "createSearchIndexes", + "schemaVersion": "1.10", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "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": "empty index definition array", + "operations": [ + { + "name": "createSearchIndexes", + "object": "collection0", + "arguments": { + "indexDefinitions": [] + }, + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [] + } + } + } + ] + } + ] + }, + { + "description": "no name provided for an index definition", + "operations": [ + { + "name": "createSearchIndexes", + "object": "collection0", + "arguments": { + "indexDefinitions": [ + { + "definition": {} + } + ] + }, + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [ + { + "definition": {} + } + ] + } + } + } + ] + } + ] + }, + { + "description": "name provided for an index definition", + "operations": [ + { + "name": "createSearchIndexes", + "object": "collection0", + "arguments": { + "indexDefinitions": [ + { + "definition": {}, + "name": "test index" + } + ] + }, + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "createSearchIndexes": "collection0", + "indexes": [ + { + "definition": {}, + "name": "test index" + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/source/index-management/tests/createSearchIndexes.yml b/source/index-management/tests/createSearchIndexes.yml new file mode 100644 index 0000000000..2482fa0723 --- /dev/null +++ b/source/index-management/tests/createSearchIndexes.yml @@ -0,0 +1,73 @@ +description: "createSearchIndexes" +schemaVersion: "1.10" +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + 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: "empty index definition array" + operations: + - name: createSearchIndexes + object: *collection0 + arguments: + indexDefinitions: [] + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + createSearchIndexes: *collection0 + indexes: [] + + - description: "no name provided for an index definition" + operations: + - name: createSearchIndexes + object: *collection0 + arguments: + indexDefinitions: [ { definition: {} } ] + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + createSearchIndexes: *collection0 + indexes: [ { definition: {} } ] + + - description: "name provided for an index definition" + operations: + - name: createSearchIndexes + object: *collection0 + arguments: + indexDefinitions: [ { definition: {}, name: 'test index' } ] + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + createSearchIndexes: *collection0 + indexes: [ { definition: {}, name: 'test index' } ] + + + \ No newline at end of file diff --git a/source/index-management/tests/dropSearchIndexes.json b/source/index-management/tests/dropSearchIndexes.json new file mode 100644 index 0000000000..87854300a7 --- /dev/null +++ b/source/index-management/tests/dropSearchIndexes.json @@ -0,0 +1,71 @@ +{ + "description": "dropSearchIndexes", + "schemaVersion": "1.10", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "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": "sends the correct command", + "operations": [ + { + "name": "dropSearchIndex", + "object": "collection0", + "arguments": { + "indexName": "test index" + }, + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "dropSearchIndex": "collection0", + "name": "test index" + } + } + } + ] + } + ] + } + ] +} diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndexes.yml new file mode 100644 index 0000000000..2a29e3d4b9 --- /dev/null +++ b/source/index-management/tests/dropSearchIndexes.yml @@ -0,0 +1,38 @@ +description: "dropSearchIndexes" +schemaVersion: "1.10" +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + 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: "sends the correct command" + operations: + - name: dropSearchIndex + object: *collection0 + arguments: + indexName: &indexName 'test index' + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + dropSearchIndex: *collection0 + name: *indexName diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json new file mode 100644 index 0000000000..909eedbe81 --- /dev/null +++ b/source/index-management/tests/listSearchIndexes.json @@ -0,0 +1,155 @@ +{ + "description": "listSearchIndexes", + "schemaVersion": "1.10", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "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": "when no name is provided, it does not populate the filter", + "operations": [ + { + "name": "listSearchIndexes", + "object": "collection0", + "arguments": [], + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "pipeline": [ + { + "$listSearchIndexes": {} + } + ] + } + } + } + ] + } + ] + }, + { + "description": "when a name is provided, it is present in the filter", + "operations": [ + { + "name": "listSearchIndexes", + "object": "collection0", + "arguments": { + "indexName": "test index" + }, + "saveResultAsEntity": "changeStream0", + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "pipeline": [ + { + "$$matchAsRoot": { + "$listSearchIndexes": { + "name": "test index" + } + } + } + ] + } + } + } + ] + } + ] + }, + { + "description": "aggregation cursor options are supported", + "operations": [ + { + "name": "listSearchIndexes", + "object": "collection0", + "arguments": { + "indexName": "test index", + "options": { + "batchSize": 10 + } + }, + "saveResultAsEntity": "changeStream0", + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": { + "batchSize": 10 + }, + "pipeline": [ + { + "$$matchAsRoot": { + "$listSearchIndexes": { + "name": "test index" + } + } + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml new file mode 100644 index 0000000000..c7c9ca7e62 --- /dev/null +++ b/source/index-management/tests/listSearchIndexes.yml @@ -0,0 +1,81 @@ +description: "listSearchIndexes" +schemaVersion: "1.10" +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + 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: "when no name is provided, it does not populate the filter" + operations: + - name: listSearchIndexes + object: *collection0 + arguments: [] + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + aggregate: *collection0 + pipeline: + - $listSearchIndexes: {} + + - description: "when a name is provided, it is present in the filter" + operations: + - name: listSearchIndexes + object: *collection0 + arguments: + indexName: &indexName "test index" + saveResultAsEntity: &changeStream0 changeStream0 + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + aggregate: *collection0 + pipeline: + - $$matchAsRoot: + $listSearchIndexes: + { name: *indexName } + + - description: aggregation cursor options are supported + operations: + - name: listSearchIndexes + object: *collection0 + arguments: + indexName: &indexName "test index" + options: + batchSize: 10 + saveResultAsEntity: &changeStream0 changeStream0 + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + aggregate: *collection0 + cursor: { batchSize: 10 } + pipeline: + - $$matchAsRoot: + $listSearchIndexes: + { name: *indexName } \ No newline at end of file diff --git a/source/index-management/tests/updateSearchIndex.json b/source/index-management/tests/updateSearchIndex.json new file mode 100644 index 0000000000..0d24b601f8 --- /dev/null +++ b/source/index-management/tests/updateSearchIndex.json @@ -0,0 +1,73 @@ +{ + "description": "updateSearchIndex", + "schemaVersion": "1.10", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "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": "sends the correct command", + "operations": [ + { + "name": "updateSearchIndex", + "object": "collection0", + "arguments": { + "indexName": "test index", + "definition": {} + }, + "expectError": {} + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "updateSearchIndex": "collection0", + "name": "test index", + "definition": {} + } + } + } + ] + } + ] + } + ] +} diff --git a/source/index-management/tests/updateSearchIndex.yml b/source/index-management/tests/updateSearchIndex.yml new file mode 100644 index 0000000000..e66f6c4cbf --- /dev/null +++ b/source/index-management/tests/updateSearchIndex.yml @@ -0,0 +1,40 @@ +description: "updateSearchIndex" +schemaVersion: "1.10" +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + 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: "sends the correct command" + operations: + - name: updateSearchIndex + object: *collection0 + arguments: + indexName: &indexName 'test index' + definition: &definition {} + expectError: {} + expectEvents: + - client: *client0 + ignoreExtraEvents: true + events: + - commandStartedEvent: + command: + updateSearchIndex: *collection0 + name: *indexName + definition: *definition From 8ec19abe3c1bba8faa4455732b1cb0a316f15895 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 17 May 2023 14:34:58 -0600 Subject: [PATCH 02/21] update unified test format --- .../unified-test-format.rst | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/source/unified-test-format/unified-test-format.rst b/source/unified-test-format/unified-test-format.rst index 56a386493b..b3d7bdb164 100644 --- a/source/unified-test-format/unified-test-format.rst +++ b/source/unified-test-format/unified-test-format.rst @@ -1803,8 +1803,7 @@ specifications: - `Change Streams <../change-streams/change-streams.rst>`__ - `CRUD <../crud/crud.rst>`__ -- `Enumerating Indexes <../enumerate-indexes.rst>`__ -- `Index Management <../index-management.rst>`__ +- `Index Management <../index-management/index-management.rst>`__ Collection operations that require special handling or are not documented by an existing specification are described below. @@ -1916,6 +1915,16 @@ Test runners MUST NOT iterate the resulting cursor when executing this operation and test files SHOULD NOT specify `operation.expectResult `_ for this operation. +createSearchIndex and createSearchIndexes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These operations proxy the collection's ``createSearchIndex`` and ``createSearchIndexes`` helpers +with the same arguments. + +dropSearchIndex +~~~~~~~~~~~~~~~ + +This operation proxies the collection's ``dropSearchIndex`` helper with the same arguments. find ~~~~ @@ -1962,6 +1971,18 @@ examples:: insertedId: { $$unsetOrMatches: 2 } +listSearchIndexes +~~~~~~~~~~~~~~~~~ + +This operation proxies the collection's ``listSearchIndexes`` helper and returns the result +of the cursor as a list. + +updateSearchIndex +~~~~~~~~~~~~~~~~~ + +This operation proxies the collection's ``updateSearchIndex`` helper with the same arguments. + + watch ~~~~~ From 89f3b21b283c9e7b2298b3f1a7aa78f06c815b8e Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 17 May 2023 14:52:52 -0600 Subject: [PATCH 03/21] sync tests --- source/index-management/tests/createSearchIndex.json | 8 ++++++-- source/index-management/tests/createSearchIndex.yml | 6 ++++-- .../index-management/tests/createSearchIndexes.json | 12 +++++++++--- .../index-management/tests/createSearchIndexes.yml | 9 ++++++--- source/index-management/tests/dropSearchIndexes.json | 4 +++- source/index-management/tests/dropSearchIndexes.yml | 3 ++- source/index-management/tests/listSearchIndexes.json | 12 +++++++++--- source/index-management/tests/listSearchIndexes.yml | 9 ++++++--- source/index-management/tests/updateSearchIndex.json | 4 +++- source/index-management/tests/updateSearchIndex.yml | 3 ++- 10 files changed, 50 insertions(+), 20 deletions(-) diff --git a/source/index-management/tests/createSearchIndex.json b/source/index-management/tests/createSearchIndex.json index 56b6593982..d29b6f8502 100644 --- a/source/index-management/tests/createSearchIndex.json +++ b/source/index-management/tests/createSearchIndex.json @@ -49,7 +49,9 @@ "definition": {} } }, - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ @@ -85,7 +87,9 @@ "name": "test index" } }, - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ diff --git a/source/index-management/tests/createSearchIndex.yml b/source/index-management/tests/createSearchIndex.yml index b9fa6cbf90..522064330e 100644 --- a/source/index-management/tests/createSearchIndex.yml +++ b/source/index-management/tests/createSearchIndex.yml @@ -27,7 +27,8 @@ tests: object: *collection0 arguments: definition: { definition: {} } - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true @@ -43,7 +44,8 @@ tests: object: *collection0 arguments: definition: { definition: {}, name: 'test index' } - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true diff --git a/source/index-management/tests/createSearchIndexes.json b/source/index-management/tests/createSearchIndexes.json index a47b68e3cb..0c574ea8b4 100644 --- a/source/index-management/tests/createSearchIndexes.json +++ b/source/index-management/tests/createSearchIndexes.json @@ -47,7 +47,9 @@ "arguments": { "indexDefinitions": [] }, - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ @@ -80,7 +82,9 @@ } ] }, - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ @@ -118,7 +122,9 @@ } ] }, - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ diff --git a/source/index-management/tests/createSearchIndexes.yml b/source/index-management/tests/createSearchIndexes.yml index 2482fa0723..9ccc0b36af 100644 --- a/source/index-management/tests/createSearchIndexes.yml +++ b/source/index-management/tests/createSearchIndexes.yml @@ -27,7 +27,8 @@ tests: object: *collection0 arguments: indexDefinitions: [] - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true @@ -43,7 +44,8 @@ tests: object: *collection0 arguments: indexDefinitions: [ { definition: {} } ] - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true @@ -59,7 +61,8 @@ tests: object: *collection0 arguments: indexDefinitions: [ { definition: {}, name: 'test index' } ] - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true diff --git a/source/index-management/tests/dropSearchIndexes.json b/source/index-management/tests/dropSearchIndexes.json index 87854300a7..003feffffb 100644 --- a/source/index-management/tests/dropSearchIndexes.json +++ b/source/index-management/tests/dropSearchIndexes.json @@ -47,7 +47,9 @@ "arguments": { "indexName": "test index" }, - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndexes.yml index 2a29e3d4b9..0377bdbd5f 100644 --- a/source/index-management/tests/dropSearchIndexes.yml +++ b/source/index-management/tests/dropSearchIndexes.yml @@ -27,7 +27,8 @@ tests: object: *collection0 arguments: indexName: &indexName 'test index' - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index 909eedbe81..fed84fd169 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -45,7 +45,9 @@ "name": "listSearchIndexes", "object": "collection0", "arguments": [], - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ @@ -79,7 +81,9 @@ "indexName": "test index" }, "saveResultAsEntity": "changeStream0", - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ @@ -120,7 +124,9 @@ } }, "saveResultAsEntity": "changeStream0", - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index c7c9ca7e62..24847b1cb4 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -26,7 +26,8 @@ tests: - name: listSearchIndexes object: *collection0 arguments: [] - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true @@ -44,7 +45,8 @@ tests: arguments: indexName: &indexName "test index" saveResultAsEntity: &changeStream0 changeStream0 - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true @@ -66,7 +68,8 @@ tests: options: batchSize: 10 saveResultAsEntity: &changeStream0 changeStream0 - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true diff --git a/source/index-management/tests/updateSearchIndex.json b/source/index-management/tests/updateSearchIndex.json index 0d24b601f8..73e9cccde3 100644 --- a/source/index-management/tests/updateSearchIndex.json +++ b/source/index-management/tests/updateSearchIndex.json @@ -48,7 +48,9 @@ "indexName": "test index", "definition": {} }, - "expectError": {} + "expectError": { + "isError": true + } } ], "expectEvents": [ diff --git a/source/index-management/tests/updateSearchIndex.yml b/source/index-management/tests/updateSearchIndex.yml index e66f6c4cbf..62508810a0 100644 --- a/source/index-management/tests/updateSearchIndex.yml +++ b/source/index-management/tests/updateSearchIndex.yml @@ -28,7 +28,8 @@ tests: arguments: indexName: &indexName 'test index' definition: &definition {} - expectError: {} + expectError: + isError: true expectEvents: - client: *client0 ignoreExtraEvents: true From 3fd818d5ef9ab0c4d76c975dda89a06e9da86863 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 18 May 2023 10:31:34 -0600 Subject: [PATCH 04/21] add stricter assertions --- .../tests/createSearchIndex.json | 30 +++++++++++++---- .../tests/createSearchIndex.yml | 11 ++++--- .../tests/createSearchIndexes.json | 33 +++++++++++++++---- .../tests/createSearchIndexes.yml | 14 +++++--- .../tests/dropSearchIndexes.json | 3 +- .../tests/dropSearchIndexes.yml | 2 ++ .../tests/listSearchIndexes.json | 18 +++++----- .../tests/listSearchIndexes.yml | 11 +++---- .../tests/updateSearchIndex.json | 3 +- .../tests/updateSearchIndex.yml | 2 ++ 10 files changed, 88 insertions(+), 39 deletions(-) diff --git a/source/index-management/tests/createSearchIndex.json b/source/index-management/tests/createSearchIndex.json index d29b6f8502..9e98fe800d 100644 --- a/source/index-management/tests/createSearchIndex.json +++ b/source/index-management/tests/createSearchIndex.json @@ -46,7 +46,11 @@ "object": "collection0", "arguments": { "definition": { - "definition": {} + "definition": { + "mappings": { + "dynamic": true + } + } } }, "expectError": { @@ -65,9 +69,14 @@ "createSearchIndexes": "collection0", "indexes": [ { - "definition": {} + "definition": { + "mappings": { + "dynamic": true + } + } } - ] + ], + "$db": "database0" } } } @@ -83,7 +92,11 @@ "object": "collection0", "arguments": { "definition": { - "definition": {}, + "definition": { + "mappings": { + "dynamic": true + } + }, "name": "test index" } }, @@ -103,10 +116,15 @@ "createSearchIndexes": "collection0", "indexes": [ { - "definition": {}, + "definition": { + "mappings": { + "dynamic": true + } + }, "name": "test index" } - ] + ], + "$db": "database0" } } } diff --git a/source/index-management/tests/createSearchIndex.yml b/source/index-management/tests/createSearchIndex.yml index 522064330e..2545de56a1 100644 --- a/source/index-management/tests/createSearchIndex.yml +++ b/source/index-management/tests/createSearchIndex.yml @@ -26,7 +26,7 @@ tests: - name: createSearchIndex object: *collection0 arguments: - definition: { definition: {} } + definition: { definition: &definition { mappings: { dynamic: true } } } expectError: isError: true expectEvents: @@ -36,14 +36,15 @@ tests: - commandStartedEvent: command: createSearchIndexes: *collection0 - indexes: [ { definition: {} } ] + indexes: [ { definition: *definition } ] + $db: *database0 - description: "name provided for an index definition" operations: - name: createSearchIndex object: *collection0 arguments: - definition: { definition: {}, name: 'test index' } + definition: { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } expectError: isError: true expectEvents: @@ -53,7 +54,9 @@ tests: - commandStartedEvent: command: createSearchIndexes: *collection0 - indexes: [ { definition: {}, name: 'test index' } ] + indexes: [ { definition: *definition, name: 'test index' } ] + $db: *database0 + \ No newline at end of file diff --git a/source/index-management/tests/createSearchIndexes.json b/source/index-management/tests/createSearchIndexes.json index 0c574ea8b4..7f219f8418 100644 --- a/source/index-management/tests/createSearchIndexes.json +++ b/source/index-management/tests/createSearchIndexes.json @@ -61,7 +61,8 @@ "commandStartedEvent": { "command": { "createSearchIndexes": "collection0", - "indexes": [] + "indexes": [], + "$db": "database0" } } } @@ -78,7 +79,11 @@ "arguments": { "indexDefinitions": [ { - "definition": {} + "definition": { + "mappings": { + "dynamic": true + } + } } ] }, @@ -98,9 +103,14 @@ "createSearchIndexes": "collection0", "indexes": [ { - "definition": {} + "definition": { + "mappings": { + "dynamic": true + } + } } - ] + ], + "$db": "database0" } } } @@ -117,7 +127,11 @@ "arguments": { "indexDefinitions": [ { - "definition": {}, + "definition": { + "mappings": { + "dynamic": true + } + }, "name": "test index" } ] @@ -138,10 +152,15 @@ "createSearchIndexes": "collection0", "indexes": [ { - "definition": {}, + "definition": { + "mappings": { + "dynamic": true + } + }, "name": "test index" } - ] + ], + "$db": "database0" } } } diff --git a/source/index-management/tests/createSearchIndexes.yml b/source/index-management/tests/createSearchIndexes.yml index 9ccc0b36af..d6f039907b 100644 --- a/source/index-management/tests/createSearchIndexes.yml +++ b/source/index-management/tests/createSearchIndexes.yml @@ -37,13 +37,15 @@ tests: command: createSearchIndexes: *collection0 indexes: [] + $db: *database0 + - description: "no name provided for an index definition" operations: - name: createSearchIndexes object: *collection0 arguments: - indexDefinitions: [ { definition: {} } ] + indexDefinitions: [ { definition: &definition { mappings: { dynamic: true } } } ] expectError: isError: true expectEvents: @@ -53,14 +55,16 @@ tests: - commandStartedEvent: command: createSearchIndexes: *collection0 - indexes: [ { definition: {} } ] + indexes: [ { definition: *definition } ] + $db: *database0 + - description: "name provided for an index definition" operations: - name: createSearchIndexes object: *collection0 arguments: - indexDefinitions: [ { definition: {}, name: 'test index' } ] + indexDefinitions: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } ] expectError: isError: true expectEvents: @@ -70,7 +74,9 @@ tests: - commandStartedEvent: command: createSearchIndexes: *collection0 - indexes: [ { definition: {}, name: 'test index' } ] + indexes: [ { definition: *definition, name: 'test index' } ] + $db: *database0 + \ No newline at end of file diff --git a/source/index-management/tests/dropSearchIndexes.json b/source/index-management/tests/dropSearchIndexes.json index 003feffffb..338a19c724 100644 --- a/source/index-management/tests/dropSearchIndexes.json +++ b/source/index-management/tests/dropSearchIndexes.json @@ -61,7 +61,8 @@ "commandStartedEvent": { "command": { "dropSearchIndex": "collection0", - "name": "test index" + "name": "test index", + "$db": "database0" } } } diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndexes.yml index 0377bdbd5f..3736e6dfdc 100644 --- a/source/index-management/tests/dropSearchIndexes.yml +++ b/source/index-management/tests/dropSearchIndexes.yml @@ -37,3 +37,5 @@ tests: command: dropSearchIndex: *collection0 name: *indexName + $db: *database0 + diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index fed84fd169..74a0efd631 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -97,13 +97,12 @@ "aggregate": "collection0", "pipeline": [ { - "$$matchAsRoot": { - "$listSearchIndexes": { - "name": "test index" - } + "$listSearchIndexes": { + "name": "test index" } } - ] + ], + "$db": "database0" } } } @@ -143,13 +142,12 @@ }, "pipeline": [ { - "$$matchAsRoot": { - "$listSearchIndexes": { - "name": "test index" - } + "$listSearchIndexes": { + "name": "test index" } } - ] + ], + "$db": "database0" } } } diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index 24847b1cb4..d44962356c 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -55,9 +55,8 @@ tests: command: aggregate: *collection0 pipeline: - - $$matchAsRoot: - $listSearchIndexes: - { name: *indexName } + - $listSearchIndexes: { name: *indexName } + $db: *database0 - description: aggregation cursor options are supported operations: @@ -79,6 +78,6 @@ tests: aggregate: *collection0 cursor: { batchSize: 10 } pipeline: - - $$matchAsRoot: - $listSearchIndexes: - { name: *indexName } \ No newline at end of file + - $listSearchIndexes: { name: *indexName } + $db: *database0 + diff --git a/source/index-management/tests/updateSearchIndex.json b/source/index-management/tests/updateSearchIndex.json index 73e9cccde3..14e6f0c8f4 100644 --- a/source/index-management/tests/updateSearchIndex.json +++ b/source/index-management/tests/updateSearchIndex.json @@ -63,7 +63,8 @@ "command": { "updateSearchIndex": "collection0", "name": "test index", - "definition": {} + "definition": {}, + "$db": "database0" } } } diff --git a/source/index-management/tests/updateSearchIndex.yml b/source/index-management/tests/updateSearchIndex.yml index 62508810a0..425d11d38e 100644 --- a/source/index-management/tests/updateSearchIndex.yml +++ b/source/index-management/tests/updateSearchIndex.yml @@ -39,3 +39,5 @@ tests: updateSearchIndex: *collection0 name: *indexName definition: *definition + $db: *database0 + From 130fe64d36886a2a35bb482938cfaa7329ae0b96 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 18 May 2023 10:40:51 -0600 Subject: [PATCH 05/21] fix schema failure --- source/index-management/tests/listSearchIndexes.json | 2 +- source/index-management/tests/listSearchIndexes.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index 74a0efd631..f1b202598b 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -44,7 +44,7 @@ { "name": "listSearchIndexes", "object": "collection0", - "arguments": [], + "arguments": {}, "expectError": { "isError": true } diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index d44962356c..2ae577b5f7 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -25,7 +25,7 @@ tests: operations: - name: listSearchIndexes object: *collection0 - arguments: [] + arguments: {} expectError: isError: true expectEvents: From f6429f811ddde892e6d6fabd829a7fd6392e7eb4 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 18 May 2023 11:01:28 -0600 Subject: [PATCH 06/21] fix schema failure --- source/index-management/tests/listSearchIndexes.json | 1 - source/index-management/tests/listSearchIndexes.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index f1b202598b..1a493eb4d7 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -44,7 +44,6 @@ { "name": "listSearchIndexes", "object": "collection0", - "arguments": {}, "expectError": { "isError": true } diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index 2ae577b5f7..0db302becc 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -25,7 +25,6 @@ tests: operations: - name: listSearchIndexes object: *collection0 - arguments: {} expectError: isError: true expectEvents: From 78dc884caafb74ad1d8810b7a22595466a32803f Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 18 May 2023 11:30:27 -0600 Subject: [PATCH 07/21] fix schema failure --- .github/workflows/check_schema_version.sh | 6 +----- source/index-management/tests/listSearchIndexes.json | 2 -- source/index-management/tests/listSearchIndexes.yml | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/check_schema_version.sh b/.github/workflows/check_schema_version.sh index ebd1e64a84..67dccd03b7 100755 --- a/.github/workflows/check_schema_version.sh +++ b/.github/workflows/check_schema_version.sh @@ -5,11 +5,7 @@ exitCode=0 # $1 - takes a single argument of the path to the JSON file containing a schemaVersion key at the top level. function get_schema_version() { - node << EOF - const { readFileSync } = require('fs') - const { load } = require('js-yaml') - console.log(load(readFileSync("./$1", { encoding: 'utf-8' })).schemaVersion) -EOF + js-yaml $1 | jq -r .schemaVersion } function get_all_schemaVersion_defining_files () { diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index 1a493eb4d7..97259ee359 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -79,7 +79,6 @@ "arguments": { "indexName": "test index" }, - "saveResultAsEntity": "changeStream0", "expectError": { "isError": true } @@ -121,7 +120,6 @@ "batchSize": 10 } }, - "saveResultAsEntity": "changeStream0", "expectError": { "isError": true } diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index 0db302becc..5a2bf7fcb0 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -43,7 +43,6 @@ tests: object: *collection0 arguments: indexName: &indexName "test index" - saveResultAsEntity: &changeStream0 changeStream0 expectError: isError: true expectEvents: @@ -65,7 +64,6 @@ tests: indexName: &indexName "test index" options: batchSize: 10 - saveResultAsEntity: &changeStream0 changeStream0 expectError: isError: true expectEvents: From 2a405d247391e1d9d1fad578bc1cae1f3fc8ab28 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 18 May 2023 11:34:49 -0600 Subject: [PATCH 08/21] update workflow --- .github/workflows/unified-test-format-schema-check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/unified-test-format-schema-check.yml b/.github/workflows/unified-test-format-schema-check.yml index bf5e99fdbb..282cc5f3bf 100644 --- a/.github/workflows/unified-test-format-schema-check.yml +++ b/.github/workflows/unified-test-format-schema-check.yml @@ -22,8 +22,7 @@ jobs: node-version: lts/* - name: Install dependencies run: | - npm install -g ajv-cli - npm install js-yaml + npm install -g ajv-cli js-yaml - name: Check unified format test files against schema working-directory: source/unified-test-format/tests run: make From e6fe40c2d89be473572c294a19e226d75182b420 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 18 May 2023 13:40:05 -0600 Subject: [PATCH 09/21] add dummy options interfces --- source/index-management/index-management.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/index-management/index-management.rst b/source/index-management/index-management.rst index 7ab2fad4af..ded3860ba7 100644 --- a/source/index-management/index-management.rst +++ b/source/index-management/index-management.rst @@ -901,6 +901,15 @@ Common Interfaces name: Optional; } + /** + * The following interfaces are empty but are provided as placeholders for drivers that cannot + * add options in a non-breaking manner, if options are added in the future. + */ + interface CreateSearchIndexOptions {} + interface UpdateSearchIndexOptions {} + interface ListSearchIndexOptions {} + interface DropSearchIndexOptions {} + Standard API for Search Indexes ------------------------------- @@ -1076,3 +1085,4 @@ Changelog :2022-10-05: Remove spec front matter and reformat changelog. :2023-5-10: Merge index enumeration and index management specs and get rid of references to legacy server versions. +:2023-5-18: Add the search index management API. From 2ee53c5e3fb79ac6b57c72a61d1408ee1c27ea44 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Fri, 19 May 2023 13:42:52 -0600 Subject: [PATCH 10/21] Updates from PR review pt 1 --- source/index-management/index-management.rst | 87 +++++++++++--------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/source/index-management/index-management.rst b/source/index-management/index-management.rst index ded3860ba7..815135493e 100644 --- a/source/index-management/index-management.rst +++ b/source/index-management/index-management.rst @@ -869,13 +869,13 @@ in a non-breaking manner (i.e., method overloading) drivers MAY omit the empty o search index management helpers. ``listSearchIndexes`` is implemented using an aggregation pipeline. The list helper MUST support a driver's aggregation -options. Drivers MAY combine the aggregation options with +options as outline in the `crud specification `_. Drivers MAY combine the aggregation options with any future ``listSearchIndexes`` stage options, if that is idiomatic for a driver's language. Notes ----- -The search index commands are asynchronous and return from the server before the index is successfully updated / created. +The search index commands are asynchronous and return from the server before the index is successfully updated, created or dropped. In order to determine when an index has been created / updated, users are expected to run the ``listSearchIndexes`` repeatedly until index changes appear. @@ -917,48 +917,49 @@ Standard API for Search Indexes interface Collection { /** - * Convenience method for creating a single search index. - * - * @return The name of the created search index - * @note Drivers MAY opt to implement this method signature, the signature that - * takes an SearchIndexModel as a parameter, or for those languages with method - * overloading MAY decide to implement both. - */ + * Convenience method for creating a single search index. + * + * @return The name of the created search index + * + * @note Drivers MAY opt to implement this method signature, the signature that + * takes an SearchIndexModel as a parameter, or for those languages with method + * overloading MAY decide to implement both. + */ createSearchIndex(name: String, definition: Document, options: Optional): String; /** - * Convenience method for creating a single index. - * - * @return The name of the created search index - * - * @note Drivers MAY opt to implement this method signature, the signature that - * takes an name and a definition as parameters, or for those languages with method - * overloading MAY decide to implement both. - */ + * Convenience method for creating a single index. + * + * @return The name of the created search index + * + * @note Drivers MAY opt to implement this method signature, the signature that + * takes an name and a definition as parameters, or for those languages with method + * overloading MAY decide to implement both. + */ createSearchIndex(model: SearchIndexModel, options: Optional): String; /** - * Creates multiple search indexes on the collection. - * - * @return An iterable of the newly created index names. - */ + * Creates multiple search indexes on the collection. + * + * @return An iterable of the newly created index names. + */ createSearchIndexes(models: Iterable, options: CreateSearchIndexOptions): Iterable ; /** - * Updates the search index with the given name to use the provided - * definition. - */ + * Updates the search index with the given name to use the provided + * definition. + */ updateSearchIndex(name: String, definition: Document, options: Optional): void; /** - * Drops the search index with the given name. - */ + * Drops the search index with the given name. + */ dropSearchIndex(name: String, options: Optional): void; /** - * Gets index information for all search indexes in the collection. - */ - listSearchIndexes(name: Optional, aggregationOptions: Optional, listIndexOptions: Optional): Cursor<{ name: String }>; + * Gets index information for all search indexes in the collection. + */ + listSearchIndexes(name: Optional, aggregationOptions: Optional, listIndexOptions: Optional): Cursor; } Index View API for Search Indexes @@ -985,14 +986,15 @@ Index View API for Search Indexes * @note For drivers that cannot make the IndexView iterable, they MUST implement a list * method. See below. */ - iterator(): Iterator<{ name: string }>; + iterator(): Iterator; /** * For drivers that cannot make SearchIndexView iterable, they MUST implement this method to * return a list of indexes. In the case of async drivers, this MAY return a Future * or language/implementation equivalent. */ - list(): Cursor<{ name: String }>; + list(): Cursor; + /** * This is a convenience method for creating a single index. @@ -1000,31 +1002,38 @@ Index View API for Search Indexes * @return The name of the created index. * * @note Drivers MAY opt to implement this method signature, the signature that - * takes an IndexModel as a parameter, or for those languages with method + * takes an SearchIndexModel as a parameter, or for those languages with method * overloading MAY decide to implement both. + */ + createOne(name: String, definition: Document, options: Optional): String; + + /** + * This is a convenience method for creating a single index. * - * @note Drivers MAY combine the two options types into a single one. If the options are - * explicitly typed, the combined options type MUST be named CreateOneIndexOptions or an acceptable - * variation. + * @return The name of the created index. + * + * @note Drivers MAY opt to implement this method signature, the signature that + * takes an name and a definition as parameters, or for those languages with method + * overloading MAY decide to implement both. */ - createOne(definition: SearchIndexDefinition, options: CreateSearchIndexOptions): String; + createOne(model: SearchIndexModel, options: Optional): String; /** * Creates multiple search indexes in the collection. * * @return The names of the created indexes. */ - createMany(models: Iterable, options: CreateSearchIndexOptions): Iterable; + createMany(models: Iterable, options: Optional): Iterable; /** * Drops a single search index from the collection by the index name. */ - dropOne(name: String, options: DropSearchIndexOptions): Result; + dropOne(name: String, options: Optional): Result; /** * Updates a single search index from the collection by the index name. */ - updateOne(name: String, options: UpdateSearchIndexOptions): Result; + updateOne(name: String, options: Optional): Result; } --------- From 0a715a5479349f756523aa5ac7cc2f1cab7cac1b Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Fri, 19 May 2023 13:45:42 -0600 Subject: [PATCH 11/21] add options to search index view API --- source/index-management/index-management.rst | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/source/index-management/index-management.rst b/source/index-management/index-management.rst index 815135493e..3a15f5fad5 100644 --- a/source/index-management/index-management.rst +++ b/source/index-management/index-management.rst @@ -971,17 +971,12 @@ Index View API for Search Indexes /** * Returns the search index view for this collection. */ - searchIndexes(options: Optional): SearchIndexView; + searchIndexes(name: Optional, aggregateOptions: Optional, options: Optional): SearchIndexView; } interface SearchIndexView extends Iterable { /** - * Enumerates the index information for all indexes in the collection. This should be - * implemented as described in the :ref:`Enumerate Indexes` section, although the naming - * requirement is dropped in favor of the driver language standard for handling iteration - * over a sequence of objects. - * - * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst + * Enumerates the index information for all search indexes in the collection. * * @note For drivers that cannot make the IndexView iterable, they MUST implement a list * method. See below. From 0b2f74f15be5a1668f3f444afd414c599898d542 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Fri, 19 May 2023 13:48:36 -0600 Subject: [PATCH 12/21] mention the index view API is optional --- source/index-management/index-management.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/index-management/index-management.rst b/source/index-management/index-management.rst index 3a15f5fad5..526640ee4c 100644 --- a/source/index-management/index-management.rst +++ b/source/index-management/index-management.rst @@ -857,7 +857,8 @@ Search Indexes -------------- Server 7.0 introduced three new server commands and a new aggregation stage to facilitate management of search indexes. Drivers MUST provide -an API similar to the existing index management API specifically for search indexes. +an API similar to the existing index management API specifically for search indexes. Drivers MAY choose to implement either the standard +API or the index view API. Search Index Management Helper Options -------------------------------------- From f44e0ed1ac0488087f8efdd265970343f66aa158 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 22 May 2023 09:08:32 -0600 Subject: [PATCH 13/21] add comment explaining expectError to yml files --- source/index-management/tests/createSearchIndex.yml | 4 ++++ source/index-management/tests/createSearchIndexes.yml | 6 ++++++ source/index-management/tests/dropSearchIndexes.yml | 2 ++ source/index-management/tests/listSearchIndexes.yml | 6 ++++++ source/index-management/tests/updateSearchIndex.yml | 4 +++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/source/index-management/tests/createSearchIndex.yml b/source/index-management/tests/createSearchIndex.yml index 2545de56a1..25e444afbe 100644 --- a/source/index-management/tests/createSearchIndex.yml +++ b/source/index-management/tests/createSearchIndex.yml @@ -28,6 +28,8 @@ tests: arguments: definition: { definition: &definition { mappings: { dynamic: true } } } expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 @@ -46,6 +48,8 @@ tests: arguments: definition: { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 diff --git a/source/index-management/tests/createSearchIndexes.yml b/source/index-management/tests/createSearchIndexes.yml index d6f039907b..5a543a8ee0 100644 --- a/source/index-management/tests/createSearchIndexes.yml +++ b/source/index-management/tests/createSearchIndexes.yml @@ -28,6 +28,8 @@ tests: arguments: indexDefinitions: [] expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 @@ -47,6 +49,8 @@ tests: arguments: indexDefinitions: [ { definition: &definition { mappings: { dynamic: true } } } ] expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 @@ -66,6 +70,8 @@ tests: arguments: indexDefinitions: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } ] expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndexes.yml index 3736e6dfdc..5695e6e553 100644 --- a/source/index-management/tests/dropSearchIndexes.yml +++ b/source/index-management/tests/dropSearchIndexes.yml @@ -28,6 +28,8 @@ tests: arguments: indexName: &indexName 'test index' expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index 5a2bf7fcb0..3853a727a5 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -26,6 +26,8 @@ tests: - name: listSearchIndexes object: *collection0 expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 @@ -44,6 +46,8 @@ tests: arguments: indexName: &indexName "test index" expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 @@ -65,6 +69,8 @@ tests: options: batchSize: 10 expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 diff --git a/source/index-management/tests/updateSearchIndex.yml b/source/index-management/tests/updateSearchIndex.yml index 425d11d38e..9d43063f61 100644 --- a/source/index-management/tests/updateSearchIndex.yml +++ b/source/index-management/tests/updateSearchIndex.yml @@ -28,7 +28,9 @@ tests: arguments: indexName: &indexName 'test index' definition: &definition {} - expectError: + expectError: + # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing + # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 From 89285841aa1bd889d810e786e326eea93cf0ce34 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 22 May 2023 09:19:16 -0600 Subject: [PATCH 14/21] explain reformatting of UTR arguments for createSearchIndex --- .../unified-test-format/unified-test-format.rst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/source/unified-test-format/unified-test-format.rst b/source/unified-test-format/unified-test-format.rst index b3d7bdb164..1367740c1f 100644 --- a/source/unified-test-format/unified-test-format.rst +++ b/source/unified-test-format/unified-test-format.rst @@ -1915,11 +1915,20 @@ Test runners MUST NOT iterate the resulting cursor when executing this operation and test files SHOULD NOT specify `operation.expectResult `_ for this operation. -createSearchIndex and createSearchIndexes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +createSearchIndex +~~~~~~~~~~~~~~~~~ + +This operations proxies the collection's ``createSearchIndex`` helper with the same arguments. + +Each ``createSearchIndex`` operation receives a `SearchIndexModel `. +If a driver has chosen to implement the ``createSearchIndex(name: String, definition: Document)`` overload +of ``createSearchIndex``, then the ``SearchIndexModel`` should be parsed by ``createSearchIndex`` unified +test runner helper and the correct arguments should be passed into the driver's helper. + +createSearchIndexes +~~~~~~~~~~~~~~~~~~~ -These operations proxy the collection's ``createSearchIndex`` and ``createSearchIndexes`` helpers -with the same arguments. +This operations proxies the collection's ``createSearchIndexes`` helper with the same arguments. dropSearchIndex ~~~~~~~~~~~~~~~ From 84f415239bdb47ef215d733c44cbcf715df0dbc2 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 23 May 2023 10:22:28 -0600 Subject: [PATCH 15/21] Apply suggestions from code review Apply changes from review to RST files. Co-authored-by: Jeremy Mikola Co-authored-by: Kevin Albertson --- source/index-management/index-management.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/index-management/index-management.rst b/source/index-management/index-management.rst index 526640ee4c..1f601a1866 100644 --- a/source/index-management/index-management.rst +++ b/source/index-management/index-management.rst @@ -870,7 +870,7 @@ in a non-breaking manner (i.e., method overloading) drivers MAY omit the empty o search index management helpers. ``listSearchIndexes`` is implemented using an aggregation pipeline. The list helper MUST support a driver's aggregation -options as outline in the `crud specification `_. Drivers MAY combine the aggregation options with +options as outline in the `CRUD specification `_. Drivers MAY combine the aggregation options with any future ``listSearchIndexes`` stage options, if that is idiomatic for a driver's language. Notes @@ -895,10 +895,10 @@ Common Interfaces .. code:: typescript interface SearchIndexModel { - // Returns the definition for this index. + // The definition for this index. definition: Document; - // Returns the name for this index, if present. + // The name for this index, if present. name: Optional; } @@ -944,7 +944,7 @@ Standard API for Search Indexes * * @return An iterable of the newly created index names. */ - createSearchIndexes(models: Iterable, options: CreateSearchIndexOptions): Iterable ; + createSearchIndexes(models: Iterable, options: CreateSearchIndexOptions): Iterable; /** * Updates the search index with the given name to use the provided @@ -958,7 +958,9 @@ Standard API for Search Indexes dropSearchIndex(name: String, options: Optional): void; /** - * Gets index information for all search indexes in the collection. + * Gets index information for one or more search indexes in the collection. + * + * If name is not specified, information for all indexes on the specified collection will be returned. */ listSearchIndexes(name: Optional, aggregationOptions: Optional, listIndexOptions: Optional): Cursor; } @@ -1088,6 +1090,6 @@ Changelog :2022-04-18: Added the ``clustered`` attribute to ``IndexOptions`` in order to support clustered collections. :2022-10-05: Remove spec front matter and reformat changelog. -:2023-5-10: Merge index enumeration and index management specs and get rid of references +:2023-05-10: Merge index enumeration and index management specs and get rid of references to legacy server versions. -:2023-5-18: Add the search index management API. +:2023-05-18: Add the search index management API. From d276fb726efcdf67e5953ddb0acaf603d7fdf9c0 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 24 May 2023 07:43:04 -0600 Subject: [PATCH 16/21] apply misc formatting changes to unified tests Co-authored-by: Jeremy Mikola Co-authored-by: Kevin Albertson --- source/index-management/tests/createSearchIndex.yml | 10 +++------- source/index-management/tests/createSearchIndexes.yml | 6 +----- source/index-management/tests/dropSearchIndexes.yml | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/source/index-management/tests/createSearchIndex.yml b/source/index-management/tests/createSearchIndex.yml index 25e444afbe..ced6b805b4 100644 --- a/source/index-management/tests/createSearchIndex.yml +++ b/source/index-management/tests/createSearchIndex.yml @@ -1,4 +1,4 @@ -description: "createSearchIndex convenience helper" +description: "createSearchIndex" schemaVersion: "1.10" createEntities: - client: @@ -26,7 +26,7 @@ tests: - name: createSearchIndex object: *collection0 arguments: - definition: { definition: &definition { mappings: { dynamic: true } } } + definition: { definition: &definition { mappings: { dynamic: true } } } expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. @@ -59,8 +59,4 @@ tests: command: createSearchIndexes: *collection0 indexes: [ { definition: *definition, name: 'test index' } ] - $db: *database0 - - - - \ No newline at end of file + $db: *database0 \ No newline at end of file diff --git a/source/index-management/tests/createSearchIndexes.yml b/source/index-management/tests/createSearchIndexes.yml index 5a543a8ee0..839f1011c9 100644 --- a/source/index-management/tests/createSearchIndexes.yml +++ b/source/index-management/tests/createSearchIndexes.yml @@ -81,8 +81,4 @@ tests: command: createSearchIndexes: *collection0 indexes: [ { definition: *definition, name: 'test index' } ] - $db: *database0 - - - - \ No newline at end of file + $db: *database0 \ No newline at end of file diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndexes.yml index 5695e6e553..56ccfa3d4a 100644 --- a/source/index-management/tests/dropSearchIndexes.yml +++ b/source/index-management/tests/dropSearchIndexes.yml @@ -1,4 +1,4 @@ -description: "dropSearchIndexes" +description: "dropSearchIndex" schemaVersion: "1.10" createEntities: - client: From 2ec9795ac0f25e659814d6196f6e61b030f013f8 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 24 May 2023 07:44:45 -0600 Subject: [PATCH 17/21] add new commands to FLE whitelist --- source/client-side-encryption/client-side-encryption.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/client-side-encryption/client-side-encryption.rst b/source/client-side-encryption/client-side-encryption.rst index ad361126a3..71fddb9848 100644 --- a/source/client-side-encryption/client-side-encryption.rst +++ b/source/client-side-encryption/client-side-encryption.rst @@ -2118,9 +2118,11 @@ endSessions BYPASS startSession BYPASS create BYPASS createIndexes BYPASS +createSearchIndexes BYPASS drop BYPASS dropDatabase BYPASS dropIndexes BYPASS +dropSearchIndex BYPASS killCursors BYPASS listCollections BYPASS listDatabases BYPASS @@ -2132,6 +2134,7 @@ killAllSessions BYPASS killSessions BYPASS killAllSessionsByPattern BYPASS refreshSessions BYPASS +updateSearchIndex BYPASS ======================== =========== All AUTOENCRYPT commands are sent to mongocryptd, even if there is no From 5f7059173e68b594e3fa345b29823d5f0f219740 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 24 May 2023 07:58:00 -0600 Subject: [PATCH 18/21] sync changes to test from Kevin's review --- source/index-management/tests/createSearchIndex.json | 8 +++----- source/index-management/tests/createSearchIndex.yml | 6 ++---- source/index-management/tests/createSearchIndexes.json | 9 +++------ source/index-management/tests/createSearchIndexes.yml | 10 +++------- source/index-management/tests/dropSearchIndexes.json | 5 ++--- source/index-management/tests/dropSearchIndexes.yml | 3 +-- source/index-management/tests/listSearchIndexes.json | 7 ++----- source/index-management/tests/listSearchIndexes.yml | 10 +++------- source/index-management/tests/updateSearchIndex.json | 3 +-- source/index-management/tests/updateSearchIndex.yml | 3 +-- 10 files changed, 21 insertions(+), 43 deletions(-) diff --git a/source/index-management/tests/createSearchIndex.json b/source/index-management/tests/createSearchIndex.json index 9e98fe800d..3958fa9075 100644 --- a/source/index-management/tests/createSearchIndex.json +++ b/source/index-management/tests/createSearchIndex.json @@ -1,5 +1,5 @@ { - "description": "createSearchIndex convenience helper", + "description": "createSearchIndex", "schemaVersion": "1.10", "createEntities": [ { @@ -45,7 +45,7 @@ "name": "createSearchIndex", "object": "collection0", "arguments": { - "definition": { + "model": { "definition": { "mappings": { "dynamic": true @@ -61,7 +61,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { @@ -91,7 +90,7 @@ "name": "createSearchIndex", "object": "collection0", "arguments": { - "definition": { + "model": { "definition": { "mappings": { "dynamic": true @@ -108,7 +107,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { diff --git a/source/index-management/tests/createSearchIndex.yml b/source/index-management/tests/createSearchIndex.yml index ced6b805b4..8e7fd81ec0 100644 --- a/source/index-management/tests/createSearchIndex.yml +++ b/source/index-management/tests/createSearchIndex.yml @@ -26,14 +26,13 @@ tests: - name: createSearchIndex object: *collection0 arguments: - definition: { definition: &definition { mappings: { dynamic: true } } } + model: { definition: &definition { mappings: { dynamic: true } } } expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: @@ -46,14 +45,13 @@ tests: - name: createSearchIndex object: *collection0 arguments: - definition: { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } + model: { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: diff --git a/source/index-management/tests/createSearchIndexes.json b/source/index-management/tests/createSearchIndexes.json index 7f219f8418..dee1945f3b 100644 --- a/source/index-management/tests/createSearchIndexes.json +++ b/source/index-management/tests/createSearchIndexes.json @@ -45,7 +45,7 @@ "name": "createSearchIndexes", "object": "collection0", "arguments": { - "indexDefinitions": [] + "models": [] }, "expectError": { "isError": true @@ -55,7 +55,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { @@ -77,7 +76,7 @@ "name": "createSearchIndexes", "object": "collection0", "arguments": { - "indexDefinitions": [ + "models": [ { "definition": { "mappings": { @@ -95,7 +94,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { @@ -125,7 +123,7 @@ "name": "createSearchIndexes", "object": "collection0", "arguments": { - "indexDefinitions": [ + "models": [ { "definition": { "mappings": { @@ -144,7 +142,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { diff --git a/source/index-management/tests/createSearchIndexes.yml b/source/index-management/tests/createSearchIndexes.yml index 839f1011c9..2d4e459eea 100644 --- a/source/index-management/tests/createSearchIndexes.yml +++ b/source/index-management/tests/createSearchIndexes.yml @@ -26,14 +26,13 @@ tests: - name: createSearchIndexes object: *collection0 arguments: - indexDefinitions: [] + models: [] expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: @@ -47,14 +46,13 @@ tests: - name: createSearchIndexes object: *collection0 arguments: - indexDefinitions: [ { definition: &definition { mappings: { dynamic: true } } } ] + models: [ { definition: &definition { mappings: { dynamic: true } } } ] expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: @@ -62,20 +60,18 @@ tests: indexes: [ { definition: *definition } ] $db: *database0 - - description: "name provided for an index definition" operations: - name: createSearchIndexes object: *collection0 arguments: - indexDefinitions: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } ] + models: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } ] expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: diff --git a/source/index-management/tests/dropSearchIndexes.json b/source/index-management/tests/dropSearchIndexes.json index 338a19c724..ddf629d330 100644 --- a/source/index-management/tests/dropSearchIndexes.json +++ b/source/index-management/tests/dropSearchIndexes.json @@ -1,5 +1,5 @@ { - "description": "dropSearchIndexes", + "description": "dropSearchIndex", "schemaVersion": "1.10", "createEntities": [ { @@ -45,7 +45,7 @@ "name": "dropSearchIndex", "object": "collection0", "arguments": { - "indexName": "test index" + "name": "test index" }, "expectError": { "isError": true @@ -55,7 +55,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndexes.yml index 56ccfa3d4a..40736b6d24 100644 --- a/source/index-management/tests/dropSearchIndexes.yml +++ b/source/index-management/tests/dropSearchIndexes.yml @@ -26,14 +26,13 @@ tests: - name: dropSearchIndex object: *collection0 arguments: - indexName: &indexName 'test index' + name: &indexName 'test index' expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index 97259ee359..3db7a7a419 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -52,7 +52,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { @@ -77,7 +76,7 @@ "name": "listSearchIndexes", "object": "collection0", "arguments": { - "indexName": "test index" + "name": "test index" }, "expectError": { "isError": true @@ -87,7 +86,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { @@ -115,7 +113,7 @@ "name": "listSearchIndexes", "object": "collection0", "arguments": { - "indexName": "test index", + "name": "test index", "options": { "batchSize": 10 } @@ -128,7 +126,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index 3853a727a5..7d22798061 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -31,7 +31,6 @@ tests: isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: @@ -44,14 +43,13 @@ tests: - name: listSearchIndexes object: *collection0 arguments: - indexName: &indexName "test index" + name: &indexName "test index" expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing # against an Atlas cluster and the expectError will be removed. isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: @@ -65,7 +63,7 @@ tests: - name: listSearchIndexes object: *collection0 arguments: - indexName: &indexName "test index" + name: &indexName "test index" options: batchSize: 10 expectError: @@ -74,7 +72,6 @@ tests: isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: @@ -82,5 +79,4 @@ tests: cursor: { batchSize: 10 } pipeline: - $listSearchIndexes: { name: *indexName } - $db: *database0 - + $db: *database0 \ No newline at end of file diff --git a/source/index-management/tests/updateSearchIndex.json b/source/index-management/tests/updateSearchIndex.json index 14e6f0c8f4..3c88d28ab5 100644 --- a/source/index-management/tests/updateSearchIndex.json +++ b/source/index-management/tests/updateSearchIndex.json @@ -45,7 +45,7 @@ "name": "updateSearchIndex", "object": "collection0", "arguments": { - "indexName": "test index", + "name": "test index", "definition": {} }, "expectError": { @@ -56,7 +56,6 @@ "expectEvents": [ { "client": "client0", - "ignoreExtraEvents": true, "events": [ { "commandStartedEvent": { diff --git a/source/index-management/tests/updateSearchIndex.yml b/source/index-management/tests/updateSearchIndex.yml index 9d43063f61..66a0514175 100644 --- a/source/index-management/tests/updateSearchIndex.yml +++ b/source/index-management/tests/updateSearchIndex.yml @@ -26,7 +26,7 @@ tests: - name: updateSearchIndex object: *collection0 arguments: - indexName: &indexName 'test index' + name: &indexName 'test index' definition: &definition {} expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing @@ -34,7 +34,6 @@ tests: isError: true expectEvents: - client: *client0 - ignoreExtraEvents: true events: - commandStartedEvent: command: From cdbbcbd8c0d3e2fbca12dbc46eda34c6f4d31f8f Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 24 May 2023 08:32:56 -0600 Subject: [PATCH 19/21] lower schema version to 1.3 --- source/index-management/tests/createSearchIndex.json | 2 +- source/index-management/tests/createSearchIndex.yml | 2 +- source/index-management/tests/createSearchIndexes.json | 2 +- source/index-management/tests/createSearchIndexes.yml | 2 +- source/index-management/tests/dropSearchIndexes.json | 2 +- source/index-management/tests/dropSearchIndexes.yml | 2 +- source/index-management/tests/listSearchIndexes.json | 2 +- source/index-management/tests/listSearchIndexes.yml | 2 +- source/index-management/tests/updateSearchIndex.json | 2 +- source/index-management/tests/updateSearchIndex.yml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/index-management/tests/createSearchIndex.json b/source/index-management/tests/createSearchIndex.json index 3958fa9075..da664631e7 100644 --- a/source/index-management/tests/createSearchIndex.json +++ b/source/index-management/tests/createSearchIndex.json @@ -1,6 +1,6 @@ { "description": "createSearchIndex", - "schemaVersion": "1.10", + "schemaVersion": "1.4", "createEntities": [ { "client": { diff --git a/source/index-management/tests/createSearchIndex.yml b/source/index-management/tests/createSearchIndex.yml index 8e7fd81ec0..0eb5c1ab1d 100644 --- a/source/index-management/tests/createSearchIndex.yml +++ b/source/index-management/tests/createSearchIndex.yml @@ -1,5 +1,5 @@ description: "createSearchIndex" -schemaVersion: "1.10" +schemaVersion: "1.4" createEntities: - client: id: &client0 client0 diff --git a/source/index-management/tests/createSearchIndexes.json b/source/index-management/tests/createSearchIndexes.json index dee1945f3b..b78b3ea6c8 100644 --- a/source/index-management/tests/createSearchIndexes.json +++ b/source/index-management/tests/createSearchIndexes.json @@ -1,6 +1,6 @@ { "description": "createSearchIndexes", - "schemaVersion": "1.10", + "schemaVersion": "1.4", "createEntities": [ { "client": { diff --git a/source/index-management/tests/createSearchIndexes.yml b/source/index-management/tests/createSearchIndexes.yml index 2d4e459eea..dc01c1b166 100644 --- a/source/index-management/tests/createSearchIndexes.yml +++ b/source/index-management/tests/createSearchIndexes.yml @@ -1,5 +1,5 @@ description: "createSearchIndexes" -schemaVersion: "1.10" +schemaVersion: "1.4" createEntities: - client: id: &client0 client0 diff --git a/source/index-management/tests/dropSearchIndexes.json b/source/index-management/tests/dropSearchIndexes.json index ddf629d330..b73447f602 100644 --- a/source/index-management/tests/dropSearchIndexes.json +++ b/source/index-management/tests/dropSearchIndexes.json @@ -1,6 +1,6 @@ { "description": "dropSearchIndex", - "schemaVersion": "1.10", + "schemaVersion": "1.4", "createEntities": [ { "client": { diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndexes.yml index 40736b6d24..5ffef7d17e 100644 --- a/source/index-management/tests/dropSearchIndexes.yml +++ b/source/index-management/tests/dropSearchIndexes.yml @@ -1,5 +1,5 @@ description: "dropSearchIndex" -schemaVersion: "1.10" +schemaVersion: "1.4" createEntities: - client: id: &client0 client0 diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index 3db7a7a419..a42df18c37 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -1,6 +1,6 @@ { "description": "listSearchIndexes", - "schemaVersion": "1.10", + "schemaVersion": "1.4", "createEntities": [ { "client": { diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index 7d22798061..9f2d939227 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -1,5 +1,5 @@ description: "listSearchIndexes" -schemaVersion: "1.10" +schemaVersion: "1.4" createEntities: - client: id: &client0 client0 diff --git a/source/index-management/tests/updateSearchIndex.json b/source/index-management/tests/updateSearchIndex.json index 3c88d28ab5..00cd7e7541 100644 --- a/source/index-management/tests/updateSearchIndex.json +++ b/source/index-management/tests/updateSearchIndex.json @@ -1,6 +1,6 @@ { "description": "updateSearchIndex", - "schemaVersion": "1.10", + "schemaVersion": "1.4", "createEntities": [ { "client": { diff --git a/source/index-management/tests/updateSearchIndex.yml b/source/index-management/tests/updateSearchIndex.yml index 66a0514175..215dbc42f9 100644 --- a/source/index-management/tests/updateSearchIndex.yml +++ b/source/index-management/tests/updateSearchIndex.yml @@ -1,5 +1,5 @@ description: "updateSearchIndex" -schemaVersion: "1.10" +schemaVersion: "1.4" createEntities: - client: id: &client0 client0 From d40f08f82c7803c708dae43bedb7e7e8b9dc4d76 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 24 May 2023 08:36:38 -0600 Subject: [PATCH 20/21] rename options to aggregationOptions --- source/index-management/tests/listSearchIndexes.json | 2 +- source/index-management/tests/listSearchIndexes.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index-management/tests/listSearchIndexes.json b/source/index-management/tests/listSearchIndexes.json index a42df18c37..41e2655fb3 100644 --- a/source/index-management/tests/listSearchIndexes.json +++ b/source/index-management/tests/listSearchIndexes.json @@ -114,7 +114,7 @@ "object": "collection0", "arguments": { "name": "test index", - "options": { + "aggregationOptions": { "batchSize": 10 } }, diff --git a/source/index-management/tests/listSearchIndexes.yml b/source/index-management/tests/listSearchIndexes.yml index 9f2d939227..7d3c3187b9 100644 --- a/source/index-management/tests/listSearchIndexes.yml +++ b/source/index-management/tests/listSearchIndexes.yml @@ -64,7 +64,7 @@ tests: object: *collection0 arguments: name: &indexName "test index" - options: + aggregationOptions: batchSize: 10 expectError: # Search indexes are only available on 7.0+ atlas clusters. DRIVERS-2630 will add e2e testing From 48b56d86bf3e1bb55d007020864e01372942693f Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 25 May 2023 09:22:40 -0600 Subject: [PATCH 21/21] dropSearchIndexes -> dropSearchIndex --- .../tests/{dropSearchIndexes.json => dropSearchIndex.json} | 0 .../tests/{dropSearchIndexes.yml => dropSearchIndex.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename source/index-management/tests/{dropSearchIndexes.json => dropSearchIndex.json} (100%) rename source/index-management/tests/{dropSearchIndexes.yml => dropSearchIndex.yml} (100%) diff --git a/source/index-management/tests/dropSearchIndexes.json b/source/index-management/tests/dropSearchIndex.json similarity index 100% rename from source/index-management/tests/dropSearchIndexes.json rename to source/index-management/tests/dropSearchIndex.json diff --git a/source/index-management/tests/dropSearchIndexes.yml b/source/index-management/tests/dropSearchIndex.yml similarity index 100% rename from source/index-management/tests/dropSearchIndexes.yml rename to source/index-management/tests/dropSearchIndex.yml