summaryrefslogtreecommitdiff
path: root/jstests/maxscan.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-04-28 16:11:27 -0400
committerEliot Horowitz <eliot@10gen.com>2010-04-28 16:11:27 -0400
commitaa82a787890de97c2613e719b114f570b5c34d06 (patch)
tree6673839320fa85968eecbd877b3b5198163acacb /jstests/maxscan.js
parente0d8e8541d2870a2280c9513ac742b5b1864c766 (diff)
downloadmongo-aa82a787890de97c2613e719b114f570b5c34d06.tar.gz
$maxScan for limiting how much to scan SERVER-1015
Diffstat (limited to 'jstests/maxscan.js')
-rw-r--r--jstests/maxscan.js14
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" )