summaryrefslogtreecommitdiff
path: root/jstests/getlog1.js
blob: 75fbeabddf272a05816037e09bfd4caed33688e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// to run: 
//   ./mongo jstests/<this-file>

contains = function(arr,obj) {
    var i = arr.length;
    while (i--) {
        if (arr[i] === obj) {
            return true;
        }
    }
    return false;
}

var resp = db.adminCommand({getLog:"*"})
assert( resp.ok == 1, "error executing getLog command" );
assert( resp.names, "no names field" );
assert( resp.names.length > 0, "names array is empty" );
assert( contains(resp.names,"global") , "missing global category" );
assert( !contains(resp.names,"butty") , "missing butty category" );

resp = db.adminCommand({getLog:"global"})
assert( resp.ok == 1, "error executing getLog command" );
assert( resp.log, "no log field" );
assert( resp.log.length > 0 , "no log lines" );