jstests/aggregation/extras/utils.js
/**
 * Assert that an aggregation fails with any code and the error message contains the given
 * string.
 */
Assert that an aggregation fails with any code and the error message contains the given
string.
Assert that an aggregation fails with any code and the error message contains the given string .
function assertErrMsgContains(coll, pipe, expectedMessage) {
    const response = assert.commandFailed(
        coll.getDB().runCommand({aggregate: coll.getName(), pipeline: pipe, cursor: {}}));
    assert.neq(
        -1,
        response.errmsg.indexOf(expectedMessage),
        "Error message did not contain '" + expectedMessage + "', found:\n" + tojson(response));
}
function assertErrMsgContains ( coll , pipe , expectedMessage ) { const response = assert . commandFailed ( coll . getDB ( ) . runCommand ( { aggregate : coll . getName ( ) , pipeline : pipe , cursor : { } } ) ) ; assert . neq ( - 1 , response . errmsg . indexOf ( expectedMessage ) , "Error message did not contain '" + expectedMessage + "', found:\n" + tojson ( response ) ) ; }
Assert that an aggregation fails with any code and the error message contains the given
 string.
Assert that an aggregation fails with any code and the error message contains the given string .