jstests/sharding/hedged_reads.js
/*
 * Returns true if there is operation with the given comment running on the
 * given connection.
 */
Returns true if there is operation with the given comment running on the
given connection.
Returns true if there is operation with the given comment running on the given connection .
function checkForOpWithComment(conn, comment) {
    const ret =
        conn.getDB("admin")
            .aggregate([{$currentOp: {localOps: true}}, {$match: {"command.comment": comment}}])
            .toArray();
    jsTestLog(`Checked currentOp with comment ${comment}: ${tojson(ret)}`);
    if (ret.length == 0) {
        return false;
    }
    if (ret.every(op => op.killPending)) {
        return false;
    }
    return true;
}
function checkForOpWithComment ( conn , comment ) { const ret = conn . getDB ( "admin" ) . aggregate ( [ { $currentOp : { localOps : true } } , { $match : { "command.comment" : comment } } ] ) . toArray ( ) ; jsTestLog ( ` ${ comment } ${ tojson ( ret ) } ` ) ; if ( ret . length == 0 ) { return false ; } if ( ret . every ( op => op . killPending ) ) { return false ; } return true ; }
Returns true if there is operation with the given comment running on the
 given connection.
Returns true if there is operation with the given comment running on the given connection .
// CurrentOp actually blocks kills from proceeding.