jstests/aggregation/expressions/expression_set_field.js
// Test that $setField fails with the provided 'code' for invalid arguments 'setFieldArgs'.
Test that $setField fails with the provided 'code' for invalid arguments 'setFieldArgs'.
Test that $setField fails with the provided ' code ' for invalid arguments ' setFieldArgs ' .
function assertSetFieldFailedWithCode(setFieldArgs, code) {
    const error =
        assert.throws(() => coll.aggregate([{$project: {test: {$setField: setFieldArgs}}}]));
    assert.commandFailedWithCode(error, code);
}
function assertSetFieldFailedWithCode ( setFieldArgs , code ) { const error = assert . throws ( ( ) => coll . aggregate ( [ { $project : { test : { $setField : setFieldArgs } } } ] ) ) ; assert . commandFailedWithCode ( error , code ) ; }
Test that $setField fails with the provided 'code' for invalid arguments 'setFieldArgs'.
Test that $setField fails with the provided ' code ' for invalid arguments ' setFieldArgs ' .