summaryrefslogtreecommitdiff
path: root/jstests/libs/create_collection_txn_helpers.js
blob: 9b6ba15eac877942aa3f87ba780865573e8a5b32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * Helper function shared by createCollection inside txns tests.
 */
const createCollAndCRUDInTxn = function(sessionDB, collName, explicitCreate) {
    if (explicitCreate) {
        assert.commandWorked(sessionDB.runCommand({create: collName}));
    }
    let sessionColl = sessionDB[collName];
    assert.commandWorked(sessionColl.insert({a: 1}));
    assert.eq(sessionColl.find({a: 1}).itcount(), 1);
    assert.eq(sessionColl.find({}).itcount(), 1);
};