jstests/multiVersion/genericChangeStreams/change_streams_multi_version_transaction.js
// and outside the transaction. Leaves all collections empty when done.
and outside the transaction. Leaves all collections empty when done.
and outside the transaction . Leaves all collections empty when done .
function performDBOps(mongod) {
    const session = mongod.startSession();
    session.startTransaction();
    const watchedColl = session.getDatabase(dbName)[watchedCollName];
    assert.commandWorked(watchedColl.insert({_id: 1}));
    assert.commandWorked(watchedColl.updateOne({_id: 1}, {$set: {a: 1}}));
    assert.commandWorked(watchedColl.remove({_id: 1}));
    const unwatchedColl = session.getDatabase(dbName)[unwatchedCollName];
    assert.commandWorked(unwatchedColl.insert({_id: 1}));
    assert.commandWorked(unwatchedColl.remove({_id: 1}));
    const watchedCollNoTxn = mongod.getDB(dbName)[watchedCollName];
    assert.commandWorked(watchedCollNoTxn.insert({_id: 2}));
    assert.commandWorked(watchedCollNoTxn.remove({_id: 2}));
    session.commitTransaction();
}
function performDBOps ( mongod ) { const session = mongod . startSession ( ) ; session . startTransaction ( ) ; const watchedColl = session . getDatabase ( dbName ) [ watchedCollName ] ; assert . commandWorked ( watchedColl . insert ( { _id : 1 } ) ) ; assert . commandWorked ( watchedColl . updateOne ( { _id : 1 } , { $set : { a : 1 } } ) ) ; assert . commandWorked ( watchedColl . remove ( { _id : 1 } ) ) ; const unwatchedColl = session . getDatabase ( dbName ) [ unwatchedCollName ] ; assert . commandWorked ( unwatchedColl . insert ( { _id : 1 } ) ) ; assert . commandWorked ( unwatchedColl . remove ( { _id : 1 } ) ) ; const watchedCollNoTxn = mongod . getDB ( dbName ) [ watchedCollName ] ; assert . commandWorked ( watchedCollNoTxn . insert ( { _id : 2 } ) ) ; assert . commandWorked ( watchedCollNoTxn . remove ( { _id : 2 } ) ) ; session . commitTransaction ( ) ; }
and outside the transaction.
and outside the transaction .