Files
mongo/jstests/core/maxscan.js
David Storch ffdb57ed20 SERVER-17544 remove $-prefixed find options from jstests and comments
Since the format for passing these options is different for the find command, these options should be specified
using the DBQuery helpers.
2015-07-23 19:51:04 -04:00

19 lines
497 B
JavaScript

t = db.maxscan;
t.drop();
N = 100;
for ( i=0; i<N; i++ ){
t.insert( { _id : i , x : i % 10 } );
}
assert.eq( N , t.find().itcount() , "A" )
assert.eq( 50 , t.find().maxScan(50).itcount() , "B" )
assert.eq( 10 , t.find( { x : 2 } ).itcount() , "C" )
assert.eq( 5 , t.find( { x : 2 } ).maxScan(50).itcount() , "D" )
t.ensureIndex({x: 1});
assert.eq( 10, t.find( { x : 2 } ).hint({x:1}).maxScan(N).itcount() , "E" )
assert.eq( 0, t.find( { x : 2 } ).hint({x:1}).maxScan(1).itcount() , "E" )