summaryrefslogtreecommitdiff
path: root/jstests/counta.js
blob: f0834d455ddebc8d96eb275e7ab34a52c185ee3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Check that count returns 0 in some exception cases.

t = db.jstests_counta;
t.drop();

for( i = 0; i < 10; ++i ) {
    t.save( {a:i} );
}

// f() is undefined, causing an assertion 
assert.throws( 
    function(){ 
        t.count( { $where:function() { if ( this.a < 5 ) { return true; } else { f(); } } } );
    } );