jstests/change_streams/apply_ops_resumability.js
// the given list of change stream events.
the given list of change stream events.
the given list of change stream events .
function findMilestoneEvents(eventList) {
    const nonTxnIdx = eventList.findIndex(event => !event.lsid),
          firstTxnIdx = eventList.findIndex(event => event.lsid),
          secondTxnIdx = eventList.findIndex((event, idx) => (idx > firstTxnIdx && event.lsid));
    return [
        nonTxnIdx,
        firstTxnIdx,
        secondTxnIdx,
        eventList[nonTxnIdx],
        eventList[firstTxnIdx],
        eventList[secondTxnIdx]
    ];
}
function findMilestoneEvents ( eventList ) { const nonTxnIdx = eventList . findIndex ( event => ! event . lsid ) , firstTxnIdx = eventList . findIndex ( event => event . lsid ) , secondTxnIdx = eventList . findIndex ( ( event , idx ) => ( idx > firstTxnIdx && event . lsid ) ) ; return [ nonTxnIdx , firstTxnIdx , secondTxnIdx , eventList [ nonTxnIdx ] , eventList [ firstTxnIdx ] , eventList [ secondTxnIdx ] ] ; }
the given list of change stream events.
the given list of change stream events .
// Return the array indices of each event, and the events themselves.