Files
mongo/jstests/core/diagnostics/opcounters_basic.js
Binh Vo 61b3edad3a SERVER-72901 Move remaining top-level core jstests to subdirectories (#30813)
GitOrigin-RevId: 0d2fb90192f7a0074b635f2707a482e8fe238cd2
2025-04-09 20:11:18 +00:00

13 lines
502 B
JavaScript

// Checks that db.serverStatus will not throw errors when metrics tree is not present.
{
const result = db.serverStatus().metrics.commands;
// Test that the metrics.commands.serverStatus value is non-zero
assert.neq(0, db.serverStatus().metrics.commands.serverStatus.total, tojson(result));
}
{
// Test that the command returns successfully when no metrics tree is present
const result = db.serverStatus({"metrics": 0});
assert.eq(undefined, result.metrics, tojson(result));
}