jstests/core/timeseries/timeseries_special_indexes_metadata.js
/**
     * Checks that listIndexes against the time-series collection returns the 'timeseriesIndexSpec'
     * index. Expects only the 'timeseriesIndexSpec' index to exist (plus an implicitly-created
     * index if the collection is implicitly sharded).
     */
Checks that listIndexes against the time-series collection returns the 'timeseriesIndexSpec'
index. Expects only the 'timeseriesIndexSpec' index to exist (plus an implicitly-created
index if the collection is implicitly sharded).
Checks that listIndexes against the time - series collection returns the ' timeseriesIndexSpec ' index . Expects only the ' timeseriesIndexSpec ' index to exist ( plus an implicitly - created index if the collection is implicitly sharded ) .
function listIndexesHasIndex(timeseriesIndexSpec) {
        const timeseriesListIndexesCursor =
            assert.commandWorked(testdb.runCommand({listIndexes: timeseriescoll.getName()})).cursor;
        const expectedNs = timeseriescoll.getFullName();
        assert.eq(expectedNs,
                  timeseriesListIndexesCursor.ns,
                  "Found unexpected namespace: " + tojson(timeseriesListIndexesCursor));
        const keys = timeseriesListIndexesCursor.firstBatch.map(d => d.key);
        const expectedKeys = FixtureHelpers.isSharded(bucketscoll) ? [{tm: 1}, timeseriesIndexSpec]
                                                                   : [timeseriesIndexSpec];
        assert.sameMembers(expectedKeys,
                           keys,
                           "Found unexpected index spec: " + tojson(timeseriesListIndexesCursor));
    }
function listIndexesHasIndex ( timeseriesIndexSpec ) { const timeseriesListIndexesCursor = assert . commandWorked ( testdb . runCommand ( { listIndexes : timeseriescoll . getName ( ) } ) ) . cursor ; const expectedNs = timeseriescoll . getFullName ( ) ; assert . eq ( expectedNs , timeseriesListIndexesCursor . ns , "Found unexpected namespace: " + tojson ( timeseriesListIndexesCursor ) ) ; const keys = timeseriesListIndexesCursor . firstBatch . map ( d => d . key ) ; const expectedKeys = FixtureHelpers . isSharded ( bucketscoll ) ? [ { tm : 1 } , timeseriesIndexSpec ] : [ timeseriesIndexSpec ] ; assert . sameMembers ( expectedKeys , keys , "Found unexpected index spec: " + tojson ( timeseriesListIndexesCursor ) ) ; }
Checks that listIndexes against the time-series collection returns the 'timeseriesIndexSpec'
 index.
Checks that listIndexes against the time - series collection returns the ' timeseriesIndexSpec ' index .
// Check the ns is OK. // Check for the index.