jstests/sharding/internal_txns/retryable_writes_retry_in_different_batches.js
/*
 * Runs all the commands in 'cmdObjs' in a retryable write or transaction as defined in
 * 'sessionOpts', and returns the responses to those commands in the given order.
 */
Runs all the commands in 'cmdObjs' in a retryable write or transaction as defined in
'sessionOpts', and returns the responses to those commands in the given order.
Runs all the commands in ' cmdObjs ' in a retryable write or transaction as defined in ' sessionOpts ' and returns the responses to those commands in the given order .
function runCommandsWithSessionOpts(db, cmdObjs, sessionOpts) {
    let cmdResponses = [];
    cmdObjs.forEach((cmdObj, index) => {
        const cmdObjWithTxnFields = makeCmdObjWithTxnFields(cmdObj, sessionOpts);
        if (sessionOpts.isTransaction && index == 0) {
            cmdObjWithTxnFields.startTransaction = true;
        }
        cmdResponses.push(assert.commandWorked(db.runCommand(cmdObjWithTxnFields)));
    });
    if (sessionOpts.isTransaction) {
        assert.commandWorked(
            db.adminCommand(makeCommitTransactionCmdObj(sessionOpts.lsid, sessionOpts.txnNumber)));
    }
    return cmdResponses;
}
function runCommandsWithSessionOpts ( db , cmdObjs , sessionOpts ) { let cmdResponses = [ ] ; cmdObjs . forEach ( ( cmdObj , index ) => { const cmdObjWithTxnFields = makeCmdObjWithTxnFields ( cmdObj , sessionOpts ) ; if ( sessionOpts . isTransaction && index == 0 ) { cmdObjWithTxnFields . startTransaction = true ; } cmdResponses . push ( assert . commandWorked ( db . runCommand ( cmdObjWithTxnFields ) ) ) ; } ) ; if ( sessionOpts . isTransaction ) { assert . commandWorked ( db . adminCommand ( makeCommitTransactionCmdObj ( sessionOpts . lsid , sessionOpts . txnNumber ) ) ) ; } return cmdResponses ; }
Runs all the commands in 'cmdObjs' in a retryable write or transaction as defined in
 'sessionOpts', and returns the responses to those commands in the given order.
Runs all the commands in ' cmdObjs ' in a retryable write or transaction as defined in ' sessionOpts ' and returns the responses to those commands in the given order .