jstests/core/collmod_convert_to_unique_violations_size_limit.js
// Checks that the violations match what we expect.
Checks that the violations match what we expect.
Checks that the violations match what we expect .
function assertFailedWithViolations(result, expectedViolations, sizeLimitViolation) {
    assert.commandFailedWithCode(result, ErrorCodes.CannotConvertIndexToUnique);
    if (sizeLimitViolation) {
        assert.eq(
            result.errmsg,
            "Cannot convert the index to unique. Too many conflicting documents were detected. " +
                "Please resolve them and rerun collMod.");
    } else {
        assert.eq(
            result.errmsg,
            "Cannot convert the index to unique. Please resolve conflicting documents before " +
                "running collMod again.");
    }
    assert.eq(bsonWoCompare(sortViolationsArray(result.violations),
                            sortViolationsArray(expectedViolations)),
              0,
              "result violations " + result.violations + " does not match expected violations " +
                  expectedViolations);
}
function assertFailedWithViolations ( result , expectedViolations , sizeLimitViolation ) { assert . commandFailedWithCode ( result , ErrorCodes . CannotConvertIndexToUnique ) ; if ( sizeLimitViolation ) { assert . eq ( result . errmsg , "Cannot convert the index to unique. Too many conflicting documents were detected. " + "Please resolve them and rerun collMod." ) ; } else { assert . eq ( result . errmsg , "Cannot convert the index to unique. Please resolve conflicting documents before " + "running collMod again." ) ; } assert . eq ( bsonWoCompare ( sortViolationsArray ( result . violations ) , sortViolationsArray ( expectedViolations ) ) , 0 , "result violations " + result . violations + " does not match expected violations " + expectedViolations ) ; }
Checks that the violations match what we expect.
Checks that the violations match what we expect .