Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Jul 27, 2023
1 parent bdf1ab8 commit a10c4bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions source/index-management/index-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ Standard API for Search Indexes
*
* @note Drivers MAY combine the `indexOptions` with the `createSearchIndexOptions`, if that is idiomatic for their language.
*/
createSearchIndex(definition: Document, indexOptions: SearchIndexOptions, createSearchIndexOptions: Optional<CreateSearchIndexOptions>): String;
createSearchIndex(definition: Document, indexOptions: Optional<SearchIndexOptions>, createSearchIndexOptions: Optional<CreateSearchIndexOptions>): String;
/**
* Convenience method for creating a single index.
Expand Down Expand Up @@ -1046,7 +1046,7 @@ Index View API for Search Indexes
*
* @note Drivers MAY combine the `indexOptions` with the `createSearchIndexOptions`, if that is idiomatic for their language.
*/
createOne(definition: Document, indexOptions: SearchIndexOptions, createSearchIndexOptions: Optional<CreateSearchIndexOptions>): String;
createOne(definition: Document, indexOptions: Optional<SearchIndexOptions>, createSearchIndexOptions: Optional<CreateSearchIndexOptions>): String;
/**
* This is a convenience method for creating a single index.
Expand Down
26 changes: 11 additions & 15 deletions source/index-management/tests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ When working locally on these tests, the same Atlas setup and teardown scripts c
Case 1: Driver can successfully create and list search indexes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Create a collection with a randomly generated name (referred to as ``coll0``).
#. Create a collection with the "create" command using a randomly generated name (referred to as ``coll0``).
#. Create a new search index on ``coll0`` with the ``createSearchIndex`` helper. Use the following definition:

.. code:: typescript
Expand All @@ -95,12 +95,12 @@ Case 1: Driver can successfully create and list search indexes
#. Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following condition is satisfied and store the value in a variable ``index``:
1. An index with the ``name`` of ``test-search-index`` is present and the index has a field ``queryable`` with a value of ``true``.

#. Assert that ``index`` has a property ``mappings`` whose value is ``{ dynamic: false }``
#. Assert that ``index`` has a property ``latestDefinition`` whose value is ``{ 'mappings': { 'dynamic': false } }``

Case 2: Driver can successfully create multiple indexes in batch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Create a collection with a randomly generated name (referred to as ``coll0``).
#. Create a collection with the "create" command using a randomly generated name (referred to as ``coll0``).
#. Create two new search indexes on ``coll0`` with the ``createSearchIndexes`` helper. Use the following
definitions when creating the indexes. These definitions are referred to as ``indexDefinitions``.

Expand All @@ -120,18 +120,14 @@ Case 2: Driver can successfully create multiple indexes in batch
}
#. Assert that the command returns an array containing the new indexes' names: ``["test-search-index-1", "test-search-index-2"]``.
#. Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following condition is satisfied. Store
the result in ``indexes``.
1. An index with the ``name`` of ``test-search-index-1`` is present and index has a field ``queryable`` with the value of ``true``.
2. An index with the ``name`` of ``test-search-index-2`` is present and index has a field ``queryable`` with the value of ``true``.
#. For each ``index`` in ``indexDefinitions``
1. Find the matching index definition in ``indexes`` by matching on ``index.name``. If no index exists, raise an error.
2. Assert that the matching index ``mappings``, whose value is ``{ dynamic: false }``

#. Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following condition is satisfied.
1. An index with the ``name`` of ``test-search-index-1`` is present and index has a field ``queryable`` with the value of ``true``. Store result in ``index1``.
2. An index with the ``name`` of ``test-search-index-2`` is present and index has a field ``queryable`` with the value of ``true``. Store result in ``index2``.
#. Assert that ``index1`` and ``index2`` have the property ``latestDefinition`` whose value is ``{ "mappings" : { "dynamic" : false } }``
Case 3: Driver can successfully drop search indexes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Create a collection with a randomly generated name (referred to as ``coll0``).
#. Create a collection with the "create" command using a randomly generated name (referred to as ``coll0``).
#. Create a new search index on ``coll0`` with the following definition:

.. code:: typescript
Expand All @@ -147,15 +143,15 @@ Case 3: Driver can successfully drop search indexes
#. Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following condition is satisfied:
1. An index with the ``name`` of ``test-search-index`` is present and index has a field ``queryable`` with the value of ``true``.

#. Run a ``dropSearchIndexes`` on ``coll0``, using ``test-search-index`` for the name.
#. Run a ``dropSearchIndex`` on ``coll0``, using ``test-search-index`` for the name.
#. Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until ``listSearchIndexes`` returns an empty array.

This test fails if it times out waiting for the deletion to succeed.

Case 4: Driver can update a search index
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Create a collection with a randomly generated name (referred to as ``coll0``).
#. Create a collection with the "create" command using a randomly generated name (referred to as ``coll0``).
#. Create a new search index on ``coll0`` with the following definition:

.. code:: typescript
Expand Down Expand Up @@ -188,7 +184,7 @@ Case 4: Driver can update a search index
2. The index has a field ``queryable`` with a value of ``true`` and has a field ``status`` with the value of ``READY``.

#. Assert that an index is present with the name ``test-search-index`` and the definition has a
property ``mappings``, whose value is ``{ dynamic: true }``
property ``latestDefinition`` whose value is ``{ 'mappings': { 'dynamic': true } }``.

Case 5: ``dropSearchIndex`` suppresses namespace not found errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit a10c4bf

Please sign in to comment.