Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRIVERS-2761 do not apply readConcern or writeConcern to search index commands #1474

Merged
merged 9 commits into from
Dec 12, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Unacknowledged/Acknowledged Writes
A non-default write concern MUST be included in the published command. The default write concern is not required to be included.

Succeeded or Failed
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^

Commands that executed on the server and return a status of ``{ ok: 1.0 }`` are considered
successful commands and MUST generate a ``CommandSucceededEvent`` and "command succeeded" log message.
Expand Down
9 changes: 7 additions & 2 deletions source/index-management/index-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@ Where are read concern and write concern?
These commands internally proxy the search index management commands to a separate process that runs alongside an Atlas cluster. As such, read concern and
write concern are not relevant for the search index management commands.

Drivers MUST NOT apply a read concern or write concern to the commands. Atlas search index management commands return an error if a ``readConcern`` or ``writeConcern`` field is present in the command.

Consistency with Existing APIs
------------------------------

Expand Down Expand Up @@ -1135,5 +1137,8 @@ Changelog
:2022-10-05: Remove spec front matter and reformat changelog.
:2023-05-10: Merge index enumeration and index management specs and get rid of references
to legacy server versions.
:2023-05-18: Add the search index management API.
:2023-07-27: Add search index management clarifications.
:2023-05-18: Add the search index management API.
:2023-07-27: Add search index management clarifications.
:2023-11-08: Clarify that ``readConcern`` and ``writeConcern`` must not be
applied to search index managment commands.

23 changes: 23 additions & 0 deletions source/index-management/tests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,26 @@ Case 5: ``dropSearchIndex`` suppresses namespace not found errors

#. Create a driver-side collection object for a randomly generated collection name. Do not create this collection on the server.
#. Run a ``dropSearchIndex`` command and assert that no error is thrown.

Case 6: Driver can successfully create and list search indexes with non-default readConcern and writeConcern
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Create a collection with the "create" command using a randomly generated name (referred to as ``coll0``).
#. Apply a write concern ``WriteConcern(w=1)`` and a read concern with ``ReadConcern(level="majority")`` to ``coll0``.
#. Create a new search index on ``coll0`` with the ``createSearchIndex`` helper. Use the following definition:

.. code:: typescript

{
name: 'test-search-index-case6',
definition: {
mappings: { dynamic: false }
}
}

#. Assert that the command returns the name of the index: ``"test-search-index-case6"``.
#. Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following condition is satisfied and store the value in a variable ``index``:

- An index with the ``name`` of ``test-search-index-case6`` is present and the index has a field ``queryable`` with a value of ``true``.

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading