jstests/core/api_version_unstable_fields.js
// Test that command with unstable fields and 'apiStrict: true' throws.
Test that command with unstable fields and 'apiStrict: true' throws.
Test that command with unstable fields and ' apiStrict : true ' throws .
function testCommandWithUnstableFields(command, unstableFields) {
    for (let field in unstableFields) {
        const cmd = JSON.parse(JSON.stringify(command));
        const cmdWithUnstableField = Object.assign(cmd, {[field]: unstableFields[field]});
        assert.commandFailedWithCode(
            db.runCommand(cmdWithUnstableField), ErrorCodes.APIStrictError, cmdWithUnstableField);
    }
}
function testCommandWithUnstableFields ( command , unstableFields ) { for ( let field in unstableFields ) { const cmd = JSON . parse ( JSON . stringify ( command ) ) ; const cmdWithUnstableField = Object . assign ( cmd , { [ field ] : unstableFields [ field ] } ) ; assert . commandFailedWithCode ( db . runCommand ( cmdWithUnstableField ) , ErrorCodes . APIStrictError , cmdWithUnstableField ) ; } }
Test that command with unstable fields and 'apiStrict: true' throws.
Test that command with unstable fields and ' apiStrict : true ' throws .