summaryrefslogtreecommitdiff
path: root/jstests/core/collmod_without_uuid.js
blob: 87d65d398b29f800164ea6049a50aa54609cadb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * SERVER-32125 Check that applyOps commands with collMod without UUID don't strip it
 */
(function() {
    "use strict";
    const collName = "collmod_without_uuid";

    function checkUUIDs() {
        let infos = db.getCollectionInfos();
        assert(infos.every((coll) => coll.name != collName || coll.info.uuid != undefined),
               "Not all collections have UUIDs: " + tojson({infos}));
    }

    db[collName].drop();
    assert.writeOK(db[collName].insert({}));
    checkUUIDs();
    let cmd = {applyOps: [{ns: "test.$cmd", op: "c", o: {collMod: collName}}]};
    let res = db.runCommand(cmd);
    assert.commandWorked(res, tojson(cmd));
    checkUUIDs();
})();