diff options
author | David Storch <david.storch@10gen.com> | 2014-08-27 15:36:08 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-09-03 09:46:33 -0400 |
commit | 391b1121e36fd85d7e85c4442dccf8367e6da770 (patch) | |
tree | 0cf17a810a3c242b2c2a6363f9f18589fedc2fb6 /jstests/core/and3.js | |
parent | 6bf17f12e3fde9bee14d2bb9c90001080546f867 (diff) | |
download | mongo-391b1121e36fd85d7e85c4442dccf8367e6da770.tar.gz |
SERVER-14742 delete old explain and turn on explain 2.0
Diffstat (limited to 'jstests/core/and3.js')
-rw-r--r-- | jstests/core/and3.js | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/jstests/core/and3.js b/jstests/core/and3.js index 036c63c02f0..3f223265522 100644 --- a/jstests/core/and3.js +++ b/jstests/core/and3.js @@ -8,10 +8,10 @@ t.save( {a:'foo'} ); t.ensureIndex( {a:1} ); -function checkScanMatch( query, nscannedObjects, n ) { +function checkScanMatch( query, docsExamined, n ) { var e = t.find( query ).hint( {a:1} ).explain(); - assert.eq( nscannedObjects, e.nscannedObjects ); - assert.eq( n, e.n ); + assert.eq( docsExamined, e.executionStats.totalDocsExamined ); + assert.eq( n, e.executionStats.nReturned ); } checkScanMatch( {a:/o/}, 1, 1 ); @@ -51,17 +51,5 @@ checkScanMatch( {$and:[{a:1},{$where:'this.a==1'}]}, 1, 1 ); checkScanMatch( {$and:[{a:1,$where:'this.a==1'}]}, 1, 1 ); checkScanMatch( {a:1,$and:[{a:1},{a:1,$where:'this.a==1'}]}, 1, 1 ); -function checkImpossibleMatch( query ) { - var e = t.find( query ).explain(); - assert.eq( 0, e.n ); - // The explain output should include the indexBounds field. - // The presence of the indexBounds field indicates that the - // query can make use of an index. - assert('indexBounds' in e, 'index bounds are missing'); -} - -// With a single key index, all bounds are utilized. -assert.eq( [[1,1]], t.find( {$and:[{a:1}]} ).explain().indexBounds.a ); -assert.eq( [[1,1]], t.find( {a:1,$and:[{a:1}]} ).explain().indexBounds.a ); -checkImpossibleMatch( {a:1,$and:[{a:2}]} ); -checkImpossibleMatch( {$and:[{a:1},{a:2}]} ); +assert.eq( 0, t.find({a:1,$and:[{a:2}]}).itcount() ); +assert.eq( 0, t.find({$and:[{a:1},{a:2}]}).itcount() ); |