jstests/noPassthrough/operator_counters_expressions.js
/**
 * Execute the `command` and compare the operator counters with the expected values.
 * @param {*} command to be executed.
 * @param {*} expectedCounters  expected operator counters.
 */
Execute the `command` and compare the operator counters with the expected values.
@param {*} command to be executed.
@param {*} expectedCounters  expected operator counters.
Execute the ` command ` and compare the operator counters with the expected values . @param { * } command to be executed . @param { * } expectedCounters expected operator counters .
function checkCounters(command, expectedCounters) {
    const origCounters = db.serverStatus().metrics.operatorCounters.expressions;
    command();
    const newCounters = db.serverStatus().metrics.operatorCounters.expressions;
    let actualCounters = {};
    for (let ec in origCounters) {
        const diff = newCounters[ec] - origCounters[ec];
        if (diff !== 0) {
            actualCounters[ec] = diff;
        }
    }
    assert.docEq(expectedCounters, actualCounters);
}
function checkCounters ( command , expectedCounters ) { const origCounters = db . serverStatus ( ) . metrics . operatorCounters . expressions ; command ( ) ; const newCounters = db . serverStatus ( ) . metrics . operatorCounters . expressions ; let actualCounters = { } ; for ( let ec in origCounters ) { const diff = newCounters [ ec ] - origCounters [ ec ] ; if ( diff !== 0 ) { actualCounters [ ec ] = diff ; } } assert . docEq ( expectedCounters , actualCounters ) ; }
Execute the `command` and compare the operator counters with the expected values.
Execute the ` command ` and compare the operator counters with the expected values .