summaryrefslogtreecommitdiff
path: root/jstests/core/collmod_without_uuid.js
blob: 68c50046a9a561ef5c0c5b94dfd4b97e0b0361df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * SERVER-32125 Check that applyOps commands with collMod without UUID don't strip it
 *
 * @tags: [
 *  requires_non_retryable_commands,
 *  # applyOps is not supported on mongos
 *  assumes_against_mongod_not_mongos,
 *  # applyOps uses the oplog that require replication support
 *  requires_replication,
 *  # Tenant migrations don't support applyOps.
 *  tenant_migration_incompatible,
 * ]
 */

(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.commandWorked(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();
})();