summaryrefslogtreecommitdiff
path: root/jstests/core/count4.js
blob: 11a43afbb01a263f2948ff84d8d2f3f1b2644d9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

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

for ( i=0; i<100; i++ ){
    t.save( { x : i } );
}

q = { x : { $gt : 25 , $lte : 75 } };

assert.eq( 50 , t.find( q ).count() , "A" );
assert.eq( 50 , t.find( q ).itcount() , "B" );

t.ensureIndex( { x : 1 } );

assert.eq( 50 , t.find( q ).count() , "C" );
assert.eq( 50 , t.find( q ).itcount() , "D" );