Skip to content

Commit 8ed5d56

Browse files
authored
SPEC-1399 Handle absence of 'ns' field in index specifications (#712)
1 parent 9117029 commit 8ed5d56

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

source/enumerate-indexes.rst

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Enumerating Indexes
1212
:Status: Draft
1313
:Type: Standards
1414
:Server Versions: 1.8-2.7.5, 2.8.0-rc3 and later
15-
:Last Modified: 2018-04-05
16-
:Version: 0.4.1
15+
:Last Modified: 2020-01-14
16+
:Version: 0.5.0
1717

1818
.. contents::
1919

@@ -279,10 +279,15 @@ subsequent retrieved documents through getmore on the cursor constructed from
279279
``res.cursor.ns`` and ``res.cursor.id``), and the query result for
280280
``system.indexes``.
281281

282-
The returned result for each variant MUST be equivalent, and each index
283-
that is returned MUST use the field names ``v``, ``key``, ``name`` and ``ns``.
284-
If the result contains additional fields, they MUST be included verbatim (like
285-
``2dsphereIndexVersion`` in the example below).
282+
In MongoDB 4.4, the ``ns`` field was removed from the index specifications returned from the ``listIndexes`` command.
283+
284+
- For drivers that report those index specifications in the form of documents or dictionaries, no special handling is
285+
necessary, but any documentation of the contents of the documents/dictionaries MUST indicate that the ``ns`` field
286+
will no longer be present in MongoDB 4.4+. If the contents of the documents/dictionaries are undocumented, then no
287+
special mention of the ``ns`` field is necessary.
288+
- For drivers that report those index specifications in the form of statically defined models, the driver MUST manually populate
289+
the ``ns`` field of the models with the appropriate namespace if the server does not report it in the ``listIndexes`` command
290+
response. The ``ns`` field is not required to be a part of the models, however.
286291

287292
Example return (a cursor which returns documents, not a simple array)::
288293

@@ -353,13 +358,15 @@ Tests
353358

354359
- verify that *all* index names are represented in the result
355360
- verify that there are no duplicate index names
356-
- there are no returned indexes that do not exist
361+
- verify there are no returned indexes that do not exist
357362

358363
- Run the driver's method that returns a list of index information records, and:
359364

360-
- all the indexes are represented in the result
361-
- the "unique" flags show up for the unique index
362-
- there are no duplicates in the returned list
365+
- verify all the indexes are represented in the result
366+
- verify the "unique" flags show up for the unique index
367+
- verify there are no duplicates in the returned list
368+
- if the result consists of statically defined index models that include an ``ns`` field, verify
369+
that its value is accurate
363370

364371

365372
Backwards Compatibility
@@ -379,6 +386,8 @@ The shell implements the first algorithm for falling back if the
379386

380387
Version History
381388
===============
389+
0.5.0 - 2020-01-14
390+
MongoDB 4.4 no longer inclues ``ns`` field in ``listIndexes`` responses.
382391

383392
0.4.1 - 2018-04-05
384393
Fix typo.

0 commit comments

Comments
 (0)