summaryrefslogtreecommitdiff
path: root/jstests/or6.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-06-08 15:55:34 -0700
committerAaron <aaron@10gen.com>2010-06-08 15:55:34 -0700
commit5be4d78fba6c8ed16aa021f294ea20111029c86a (patch)
tree8dd616ec8e280d4b2fbe082fd2e6b85b3695a94e /jstests/or6.js
parent05c5af2b40cc840b455dfdd09042c738f872b946 (diff)
downloadmongo-5be4d78fba6c8ed16aa021f294ea20111029c86a.tar.gz
SERVER-109 handle dynamically removed or clauses when iterating clauses
Diffstat (limited to 'jstests/or6.js')
-rw-r--r--jstests/or6.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/jstests/or6.js b/jstests/or6.js
index 3a0369ebbdb..00c94a71cd3 100644
--- a/jstests/or6.js
+++ b/jstests/or6.js
@@ -6,4 +6,11 @@ t.ensureIndex( {a:1} );
assert.eq.automsg( "2", "t.find( {$or:[{a:{$gt:2}},{a:{$gt:0}}]} ).explain().clauses[ 1 ].indexBounds[ 0 ][ 1 ].a" );
assert.eq.automsg( "2", "t.find( {$or:[{a:{$lt:2}},{a:{$lt:4}}]} ).explain().clauses[ 1 ].indexBounds[ 0 ][ 0 ].a" );
-printjson( t.find( {$or:[{a:{$lt:2}},{a:{$lt:4}}]} ).explain() ); \ No newline at end of file
+assert.eq.automsg( "2", "t.find( {$or:[{a:{$gt:2,$lt:10}},{a:{$gt:0,$lt:5}}]} ).explain().clauses[ 1 ].indexBounds[ 0 ][ 1 ].a" );
+assert.eq.automsg( "0", "t.find( {$or:[{a:{$gt:2,$lt:10}},{a:{$gt:0,$lt:15}}]} ).explain().clauses[ 1 ].indexBounds[ 0 ][ 0 ].a" );
+assert.eq.automsg( "15", "t.find( {$or:[{a:{$gt:2,$lt:10}},{a:{$gt:0,$lt:15}}]} ).explain().clauses[ 1 ].indexBounds[ 0 ][ 1 ].a" );
+
+// no separate clauses
+assert.eq.automsg( "null", "t.find( {$or:[{a:{$gt:2,$lt:10}},{a:{$gt:3,$lt:5}}]} ).explain().clauses" );
+
+assert.eq.automsg( "20", "t.find( {$or:[{a:{$gt:2,$lt:10}},{a:{$gt:3,$lt:5}},{a:{$gt:20}}]} ).explain().clauses[ 1 ].indexBounds[ 0 ][ 0 ].a" ); \ No newline at end of file