jstests/libs/transactions_util.js
// 'transactionOptions' - parameters for the transaction.
'transactionOptions' - parameters for the transaction.
' transactionOptions ' - parameters for the transaction .
function runInTransaction(db, beforeTransactionFunc, func, transactionOptions = {}) {
        const session = db.getMongo().startSession();
        const sessionDb = session.getDatabase(db.getName());
        const state = beforeTransactionFunc(sessionDb, session);
        session.startTransaction(transactionOptions);
        func(sessionDb, state);
        return session.commitTransaction_forTesting();
    }
function runInTransaction ( db , beforeTransactionFunc , func , transactionOptions = { } ) { const session = db . getMongo ( ) . startSession ( ) ; const sessionDb = session . getDatabase ( db . getName ( ) ) ; const state = beforeTransactionFunc ( sessionDb , session ) ; session . startTransaction ( transactionOptions ) ; func ( sessionDb , state ) ; return session . commitTransaction_forTesting ( ) ; }
'transactionOptions' - parameters for the transaction.
' transactionOptions ' - parameters for the transaction .