jstests/concurrency/fsm_workload_helpers/delete_in_transaction_states.js
/**
 * Gives each document assigned to this thread a group id for multi=true deletes, and loads each
 * document into memory.
 */
Gives each document assigned to this thread a group id for multi=true deletes, and loads each
document into memory.
Gives each document assigned to this thread a group id for multi = true deletes and loads each document into memory .
function initDeleteInTransactionStates(db, collName, tid) {
    let nextGroupIdForInit = nextGroupId[collName] = 0;
    db[collName].find({tid: tid}).forEach(doc => {
        assert.commandWorked(
            db[collName].update({_id: doc._id}, {$set: {groupId: nextGroupIdForInit}}));
        nextGroupIdForInit = (nextGroupIdForInit + 1) % numGroupsWithinThread;
    });
    expectedDocuments[collName] = db[collName].find({tid: tid}).toArray();
}
function initDeleteInTransactionStates ( db , collName , tid ) { let nextGroupIdForInit = nextGroupId [ collName ] = 0 ; db [ collName ] . find ( { tid : tid } ) . forEach ( doc => { assert . commandWorked ( db [ collName ] . update ( { _id : doc . _id } , { $set : { groupId : nextGroupIdForInit } } ) ) ; nextGroupIdForInit = ( nextGroupIdForInit + 1 ) % numGroupsWithinThread ; } ) ; expectedDocuments [ collName ] = db [ collName ] . find ( { tid : tid } ) . toArray ( ) ; }
Gives each document assigned to this thread a group id for multi=true deletes, and loads each
 document into memory.
Gives each document assigned to this thread a group id for multi = true deletes and loads each document into memory .
// Assign each document owned by this thread to a different "group" so they can be multi // deleted by group later. // Store the updated documents in-memory so the test can verify the expected ones are // deleted.