jstests/core/verify_update_mods.js
// and verifies that the results are as expected.
and verifies that the results are as expected.
and verifies that the results are as expected .
function executeUpdateTestCase(testCase) {
    jsTestLog(tojson(testCase));
    assert.commandWorked(coll.remove({}));
    assert.commandWorked(coll.insert(testCase.inputDocuments));
    const result = testCase.command(coll, testCase.query, testCase.update, testCase.arrayFilters);
    if (testCase.expectedErrorCode == undefined) {
        assert.commandWorked(result);
        assert.docEq(coll.find({}).sort({_id: 1}).toArray(), testCase.expectedResults);
    } else {
        assert.commandFailedWithCode(result, testCase.expectedErrorCode);
    }
}
function executeUpdateTestCase ( testCase ) { jsTestLog ( tojson ( testCase ) ) ; assert . commandWorked ( coll . remove ( { } ) ) ; assert . commandWorked ( coll . insert ( testCase . inputDocuments ) ) ; const result = testCase . command ( coll , testCase . query , testCase . update , testCase . arrayFilters ) ; if ( testCase . expectedErrorCode == undefined ) { assert . commandWorked ( result ) ; assert . docEq ( coll . find ( { } ) . sort ( { _id : 1 } ) . toArray ( ) , testCase . expectedResults ) ; } else { assert . commandFailedWithCode ( result , testCase . expectedErrorCode ) ; } }
and verifies that the results are as expected.
and verifies that the results are as expected .
// Remove all existing documents and then insert the new test case's documents. // Issue the update command specified in the test case. // Verify that the command succeeded and collection's contents match the expected results.