diff options
Diffstat (limited to 'jstests/core/indexq.js')
-rw-r--r-- | jstests/core/indexq.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/jstests/core/indexq.js b/jstests/core/indexq.js new file mode 100644 index 00000000000..38cd27b8798 --- /dev/null +++ b/jstests/core/indexq.js @@ -0,0 +1,20 @@ +// Test multikey range preference for a fully included range SERVER-958. + +t = db.jstests_indexq; +t.drop(); + +t.ensureIndex( {a:1} ); +// Single key index +assert.eq( 5, t.find( {a:{$gt:4,$gte:5}} ).explain().indexBounds.a[ 0 ][ 0 ] ); +assert.eq( [[1,1],[2,2]], t.find( {a:{$in:[1,2,3]},$or:[{a:{$in:[1,2]}}]} ).explain().indexBounds.a ); + +t.save( {a:[1,3]} ); +// Now with multi key index. + +// SERVER-12281: We should know that >4 is worse than >5 +// assert.eq( 5, t.find( {a:{$gt:4,$gte:5}} ).explain().indexBounds.a[ 0 ][ 0 ] ); + +printjson(t.find( {a:{$in:[1,2,3]},$or:[{a:{$in:[1,2]}}]} ).explain()) + +// SERVER-12281: We should know that in[1,2] is better than in[1,2,3]. +// assert.eq( [[1,1],[2,2]], t.find( {a:{$in:[1,2,3]},$or:[{a:{$in:[1,2]}}]} ).explain().indexBounds.a ); |