summaryrefslogtreecommitdiff
path: root/jstests/index_check6.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-10-19 09:52:45 -0400
committerEliot Horowitz <eliot@10gen.com>2009-10-19 09:52:45 -0400
commit78ab7365b4c8699de95c35d9d057cfcf2696d98a (patch)
tree7e09cdefbe485eab8b539a0b8dacede699a726d0 /jstests/index_check6.js
parent11ea1f1504f32f2cd3ae0c3c115d983948c9321d (diff)
downloadmongo-78ab7365b4c8699de95c35d9d057cfcf2696d98a.tar.gz
test for SERVER-371
Diffstat (limited to 'jstests/index_check6.js')
-rw-r--r--jstests/index_check6.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/jstests/index_check6.js b/jstests/index_check6.js
new file mode 100644
index 00000000000..71e642086ae
--- /dev/null
+++ b/jstests/index_check6.js
@@ -0,0 +1,17 @@
+
+t = db.index_check6;
+t.drop();
+
+t.ensureIndex( { age : 1 , rating : 1 } );
+
+for ( var age=10; age<50; age++ ){
+ for ( var rating=0; rating<10; rating++ ){
+ t.save( { age : age , rating : rating } );
+ }
+}
+
+assert.eq( 10 , t.find( { age : 30 } ).explain().nscanned , "A" );
+assert.eq( 20 , t.find( { age : { $gte : 29 , $lte : 30 } } ).explain().nscanned , "B" );
+
+//assert.eq( 2 , t.find( { age : { $gte : 29 , $lte : 30 } , rating : 5 } ).explain().nscanned , "C" ); // SERVER-371
+//assert.eq( 4 , t.find( { age : { $gte : 29 , $lte : 30 } , rating : { $gte : 4 , $lte : 5 } } ).explain().nscanned , "D" ); // SERVER-371