jstests/noPassthroughWithMongod/plan_cache_replanning.js
/**
 * Asserts that the plan contained in the plan cache 'entry' is an index scan plan over the index
 * with the given 'indexName'.
 *
 * Also verifies that the query hash matches the provided 'expectedQueryHash'.
 */
Asserts that the plan contained in the plan cache 'entry' is an index scan plan over the index
with the given 'indexName'.

Also verifies that the query hash matches the provided 'expectedQueryHash'.
Asserts that the plan contained in the plan cache ' entry ' is an index scan plan over the index with the given ' indexName ' . Also verifies that the query hash matches the provided ' expectedQueryHash ' .
function assertPlanHasIxScanStage(entry, indexName, expectedQueryHash) {
    assert.eq(entry.queryHash, expectedQueryHash, entry);
    const cachedPlan = getCachedPlan(entry.cachedPlan);
    if (isSbePlanCacheEnabled) {
        assert.eq(entry.version, "2", entry);
        assert(cachedPlan.hasOwnProperty("stages"));
        const planDebugString = cachedPlan.stages;
        assert(planDebugString.includes(indexName), entry);
    } else {
        assert.eq(entry.version, "1", entry);
        const stage = getPlanStage(cachedPlan, "IXSCAN");
        assert.neq(stage, null, entry);
        assert.eq(indexName, stage.indexName, entry);
    }
}
function assertPlanHasIxScanStage ( entry , indexName , expectedQueryHash ) { assert . eq ( entry . queryHash , expectedQueryHash , entry ) ; const cachedPlan = getCachedPlan ( entry . cachedPlan ) ; if ( isSbePlanCacheEnabled ) { assert . eq ( entry . version , "2" , entry ) ; assert ( cachedPlan . hasOwnProperty ( "stages" ) ) ; const planDebugString = cachedPlan . stages ; assert ( planDebugString . includes ( indexName ) , entry ) ; } else { assert . eq ( entry . version , "1" , entry ) ; const stage = getPlanStage ( cachedPlan , "IXSCAN" ) ; assert . neq ( stage , null , entry ) ; assert . eq ( indexName , stage . indexName , entry ) ; } }
Asserts that the plan contained in the plan cache 'entry' is an index scan plan over the index
 with the given 'indexName'.
Asserts that the plan contained in the plan cache ' entry ' is an index scan plan over the index with the given ' indexName ' .
// The $planCacheStats output for the SBE plan cache only contains an debug string // representation of the execution plan. Rather than parse this string, we just check that // the index name appears somewhere in the plan.