summaryrefslogtreecommitdiff
path: root/jstests/libs/check_uuids.js
blob: 54cf9bd2f9029a0f38591882c28a0fddb15afa7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Contains helpers for checking UUIDs on collections.

/**
 * Verifies that all collections on all databases on the server with admin database adminDB have
 * UUIDs.
 */
function checkCollectionUUIDs(adminDB) {
    let res = adminDB.runCommand({"listDatabases": 1});
    assert.commandWorked(res);
    let databaseList = res.databases;

    databaseList.forEach(function(database) {
        let currentDatabase = adminDB.getSiblingDB(database.name);
        let collectionInfos = currentDatabase.getCollectionInfos();
        for (let i = 0; i < collectionInfos.length; i++) {
            assert(collectionInfos[i].info.uuid,
                   "Expect uuid for collection: " + tojson(collectionInfos[i]));
        }
    });
}