jstests/core/or_to_in.js
// Check that 'expectedQuery' and 'actualQuery' have the same plans, and produce the same result.
Check that 'expectedQuery' and 'actualQuery' have the same plans, and produce the same result.
Check that ' expectedQuery ' and ' actualQuery ' have the same plans and produce the same result .
function assertEquivPlanAndResult(expectedQuery, actualQuery) {
    const expectedExplain = coll.find(expectedQuery).explain("queryPlanner");
    const actualExplain = coll.find(actualQuery).explain("queryPlanner");
    assert.docEq(expectedExplain.parsedQuery, actualExplain.parsedQuery);
    const expectedPlan = getWinningPlan(expectedExplain.queryPlanner);
    const actualPlan = getWinningPlan(actualExplain.queryPlanner);
    if (!checkBothEnginesAreRunOnCluster(db)) {
        assert.docEq(expectedPlan, actualPlan);
    }
    const expectedRes = coll.find(expectedQuery).toArray();
    const actualRes = coll.find(actualQuery).toArray();
    assert(arrayEq(expectedRes, actualRes, false, compareValues),
           `expected=${expectedRes}, actual=${actualRes}`);
}
function assertEquivPlanAndResult ( expectedQuery , actualQuery ) { const expectedExplain = coll . find ( expectedQuery ) . explain ( "queryPlanner" ) ; const actualExplain = coll . find ( actualQuery ) . explain ( "queryPlanner" ) ; assert . docEq ( expectedExplain . parsedQuery , actualExplain . parsedQuery ) ; const expectedPlan = getWinningPlan ( expectedExplain . queryPlanner ) ; const actualPlan = getWinningPlan ( actualExplain . queryPlanner ) ; if ( ! checkBothEnginesAreRunOnCluster ( db ) ) { assert . docEq ( expectedPlan , actualPlan ) ; } const expectedRes = coll . find ( expectedQuery ) . toArray ( ) ; const actualRes = coll . find ( actualQuery ) . toArray ( ) ; assert ( arrayEq ( expectedRes , actualRes , false , compareValues ) , ` ${ expectedRes } ${ actualRes } ` ) ; }
Check that 'expectedQuery' and 'actualQuery' have the same plans, and produce the same result.
Check that ' expectedQuery ' and ' actualQuery ' have the same plans and produce the same result .
// The queries must be rewritten into the same form. // Make sure both queries have the same access plan. // The queries must produce the same result.