jstests/core/explain_includes_command.js
/*
 * Runs explain on 'cmdToExplain' and ensures that the explain output contains the expected
 * 'command' field.
 */
Runs explain on 'cmdToExplain' and ensures that the explain output contains the expected
'command' field.
Runs explain on ' cmdToExplain ' and ensures that the explain output contains the expected ' command ' field .
function testExplainContainsCommand(cmdToExplain) {
    const verbosity = ["queryPlanner", "executionStats", "allPlansExecution"];
    for (const option of verbosity) {
        const explainOutput = db.runCommand({explain: cmdToExplain, verbosity: option});
        assert("command" in explainOutput);
        const explainCmd = explainOutput["command"];
        for (let key of Object.keys(cmdToExplain)) {
            assert.eq(explainCmd[key], cmdToExplain[key]);
        }
    }
}
function testExplainContainsCommand ( cmdToExplain ) { const verbosity = [ "queryPlanner" , "executionStats" , "allPlansExecution" ] ; for ( const option of verbosity ) { const explainOutput = db . runCommand ( { explain : cmdToExplain , verbosity : option } ) ; assert ( "command" in explainOutput ) ; const explainCmd = explainOutput [ "command" ] ; for ( let key of Object . keys ( cmdToExplain ) ) { assert . eq ( explainCmd [ key ] , cmdToExplain [ key ] ) ; } } }
Runs explain on 'cmdToExplain' and ensures that the explain output contains the expected
 'command' field.
Runs explain on ' cmdToExplain ' and ensures that the explain output contains the expected ' command ' field .