diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-04-28 16:11:27 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-04-28 16:11:27 -0400 |
commit | aa82a787890de97c2613e719b114f570b5c34d06 (patch) | |
tree | 6673839320fa85968eecbd877b3b5198163acacb /jstests/maxscan.js | |
parent | e0d8e8541d2870a2280c9513ac742b5b1864c766 (diff) | |
download | mongo-aa82a787890de97c2613e719b114f570b5c34d06.tar.gz |
$maxScan for limiting how much to scan SERVER-1015
Diffstat (limited to 'jstests/maxscan.js')
-rw-r--r-- | jstests/maxscan.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/jstests/maxscan.js b/jstests/maxscan.js new file mode 100644 index 00000000000..c455efbf3ea --- /dev/null +++ b/jstests/maxscan.js @@ -0,0 +1,14 @@ + +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()._addSpecial( "$maxScan" , 50 ).itcount() , "B" ) + +assert.eq( 10 , t.find( { x : 2 } ).itcount() , "C" ) +assert.eq( 5 , t.find( { x : 2 } )._addSpecial( "$maxScan" , 50 ).itcount() , "D" ) |