jstests/libs/profiler.js
/**
 * Throws an assertion if the profiler contains more than 'maxExpectedMatches' entries matching
 * "filter", or if there are no matches. Optional arguments "errorMsgFilter" and "errorMsgProj"
 * limit profiler output if this asserts.
 */
Throws an assertion if the profiler contains more than 'maxExpectedMatches' entries matching
"filter", or if there are no matches. Optional arguments "errorMsgFilter" and "errorMsgProj"
limit profiler output if this asserts.
Throws an assertion if the profiler contains more than ' maxExpectedMatches ' entries matching " filter " or if there are no matches . Optional arguments " errorMsgFilter " and " errorMsgProj " limit profiler output if this asserts .
function profilerHasAtLeastOneAtMostNumMatchingEntriesOrThrow(
    {profileDB, filter, maxExpectedMatches, errorMsgFilter, errorMsgProj}) {
    assert(typeof maxExpectedMatches === 'number' && maxExpectedMatches > 0,
           "'maxExpectedMatches' must be a number > 0");
    const numMatches = profileDB.system.profile.find(filter).itcount();
    assert.gt(numMatches,
              0,
              "Expected at least 1 op matching: " + tojson(filter) + " in profiler " +
                  tojson(profileDB.system.profile.find(errorMsgFilter, errorMsgProj).toArray()));
    assert.lte(numMatches,
               maxExpectedMatches,
               "Expected at most " + maxExpectedMatches + " op(s) matching: " + tojson(filter) +
                   " in profiler " +
                   tojson(profileDB.system.profile.find(errorMsgFilter, errorMsgProj).toArray()));
}
function profilerHasAtLeastOneAtMostNumMatchingEntriesOrThrow ( { profileDB , filter , maxExpectedMatches , errorMsgFilter , errorMsgProj } ) { assert ( typeof maxExpectedMatches === 'number' && maxExpectedMatches > 0 , "'maxExpectedMatches' must be a number > 0" ) ; const numMatches = profileDB . system . profile . find ( filter ) . itcount ( ) ; assert . gt ( numMatches , 0 , "Expected at least 1 op matching: " + tojson ( filter ) + " in profiler " + tojson ( profileDB . system . profile . find ( errorMsgFilter , errorMsgProj ) . toArray ( ) ) ) ; assert . lte ( numMatches , maxExpectedMatches , "Expected at most " + maxExpectedMatches + " op(s) matching: " + tojson ( filter ) + " in profiler " + tojson ( profileDB . system . profile . find ( errorMsgFilter , errorMsgProj ) . toArray ( ) ) ) ; }
Throws an assertion if the profiler contains more than 'maxExpectedMatches' entries matching
 "filter", or if there are no matches.
Throws an assertion if the profiler contains more than ' maxExpectedMatches ' entries matching " filter " or if there are no matches .