jstests/concurrency/fsm_workload_helpers/delete_in_transaction_states.js
/**
 * Sends a multi=false delete with an exact match on _id for a random id, which should be sent
 * to all shards.
 */
Sends a multi=false delete with an exact match on _id for a random id, which should be sent
to all shards.
Sends a multi = false delete with an exact match on _id for a random id which should be sent to all shards .
function exactIdDelete(db, collName, session) {
    if (!expectedDocuments[collName].length) {
        print('This thread owns no more documents for collection ' + db[collName] +
              ', skipping exactIdDelete stage');
        return;
    }
    const idToDelete = getIdForDelete(collName);
    const collection = session.getDatabase(db.getName()).getCollection(collName);
    withTxnAndAutoRetry(session, () => {
        assertWhenOwnColl.commandWorked(collection.remove({_id: idToDelete}, {multi: false}));
    });
    expectedDocuments[collName] = expectedDocuments[collName].filter(obj => {
        return obj._id !== idToDelete;
    });
}
function exactIdDelete ( db , collName , session ) { if ( ! expectedDocuments [ collName ] . length ) { print ( 'This thread owns no more documents for collection ' + db [ collName ] + ', skipping exactIdDelete stage' ) ; return ; } const idToDelete = getIdForDelete ( collName ) ; const collection = session . getDatabase ( db . getName ( ) ) . getCollection ( collName ) ; withTxnAndAutoRetry ( session , ( ) => { assertWhenOwnColl . commandWorked ( collection . remove ( { _id : idToDelete } , { multi : false } ) ) ; } ) ; expectedDocuments [ collName ] = expectedDocuments [ collName ] . filter ( obj => { return obj . _id !== idToDelete ; } ) ; }
Sends a multi=false delete with an exact match on _id for a random id, which should be sent
 to all shards.
Sends a multi = false delete with an exact match on _id for a random id which should be sent to all shards .
// If no documents remain in our partition, there is nothing to do. // Remove the deleted document from the in-memory representation.