2015-11-02 14:04:16 -05:00
|
|
|
// Tests the use of a match predicate with the currentOp command.
|
|
|
|
|
(function() {
|
|
|
|
|
// Test a $where predicate that matches the currentOp operation we are running.
|
2016-05-28 17:55:12 -04:00
|
|
|
var res = db.adminCommand("currentOp", {
|
|
|
|
|
$where: function() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-11-02 14:04:16 -05:00
|
|
|
assert.commandWorked(res);
|
|
|
|
|
assert.gt(res.inprog.length, 0, tojson(res));
|
|
|
|
|
|
|
|
|
|
// Test a $where predicate that matches no operations.
|
2016-05-28 17:55:12 -04:00
|
|
|
res = db.adminCommand("currentOp", {
|
|
|
|
|
$where: function() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-11-02 14:04:16 -05:00
|
|
|
assert.commandWorked(res);
|
|
|
|
|
assert.eq(res.inprog.length, 0, tojson(res));
|
|
|
|
|
})();
|