jstests/core/index_signature.js
// number of indexes changed in accordance with the 'expectedChange' argument.
number of indexes changed in accordance with the 'expectedChange' argument.
number of indexes changed in accordance with the ' expectedChange ' argument .
function buildIndexAndAssertChangeInIndexCount(keyPattern, indexOptions, expectedChange) {
    const numIndexesBefore = coll.getIndexes().length;
    const cmdRes = assert.commandWorked(coll.createIndex(keyPattern, indexOptions));
    assert(cmdRes.numIndexesBefore != null || Object.values(cmdRes.raw), tojson(cmdRes));
    const numIndexesAfter =
        (cmdRes.numIndexesAfter != null ? cmdRes.numIndexesAfter
                                        : Object.values(cmdRes.raw)[0].numIndexesAfter);
    assert.eq(numIndexesAfter, numIndexesBefore + expectedChange, cmdRes);
}
function buildIndexAndAssertChangeInIndexCount ( keyPattern , indexOptions , expectedChange ) { const numIndexesBefore = coll . getIndexes ( ) . length ; const cmdRes = assert . commandWorked ( coll . createIndex ( keyPattern , indexOptions ) ) ; assert ( cmdRes . numIndexesBefore != null || Object . values ( cmdRes . raw ) , tojson ( cmdRes ) ) ; const numIndexesAfter = ( cmdRes . numIndexesAfter != null ? cmdRes . numIndexesAfter : Object . values ( cmdRes . raw ) [ 0 ] . numIndexesAfter ) ; assert . eq ( numIndexesAfter , numIndexesBefore + expectedChange , cmdRes ) ; }
number of indexes changed in accordance with the 'expectedChange' argument.
number of indexes changed in accordance with the ' expectedChange ' argument .
// In a sharded cluster, the results from all shards are returned in cmdRes.raw.