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