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