summaryrefslogtreecommitdiff
path: root/jstests/core/currentop_predicate.js
blob: 98df3c9756eba12e31148252b7ab3854eee01e6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Tests the use of a match predicate with the currentOp command.
(function() {
    // Test a $where predicate that matches the currentOp operation we are running.
    var res = db.adminCommand("currentOp",
                              {
                                $where: function() {
                                    return true;
                                }
                              });
    assert.commandWorked(res);
    assert.gt(res.inprog.length, 0, tojson(res));

    // Test a $where predicate that matches no operations.
    res = db.adminCommand("currentOp",
                          {
                            $where: function() {
                                return false;
                            }
                          });
    assert.commandWorked(res);
    assert.eq(res.inprog.length, 0, tojson(res));
})();