summaryrefslogtreecommitdiff
path: root/jstests/or6.js
diff options
context:
space:
mode:
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