diff options
author | Aaron <aaron@10gen.com> | 2012-03-13 17:33:56 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-03-13 20:54:07 -0700 |
commit | 88ea9f1fac06685d59a61a7f1d445b396f02441e (patch) | |
tree | 8d05ef4c04f38af53d4a9ed47bfc9427ef1ab13a /jstests/explain4.js | |
parent | f427d5cd4f1fe89ac5688c5e914a32d722f7a450 (diff) | |
download | mongo-88ea9f1fac06685d59a61a7f1d445b396f02441e.tar.gz |
SERVER-4150 Separate match reporting from ordered match reporting for proper plan specific output when a single out of order plan runs; fix incorrect explain4 test.
Diffstat (limited to 'jstests/explain4.js')
-rw-r--r-- | jstests/explain4.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/jstests/explain4.js b/jstests/explain4.js index fe5cf73d7b7..1c81aefdd53 100644 --- a/jstests/explain4.js +++ b/jstests/explain4.js @@ -1,9 +1,9 @@ -// Basic validation of explain output fields +// Basic validation of explain output fields. t = db.jstests_explain4; t.drop(); -function checkField( name, value ) { +function checkField( explain, name, value ) { assert( explain.hasOwnProperty( name ) ); if ( value != null ) { assert.eq( value, explain[ name ], name ); @@ -11,33 +11,33 @@ function checkField( name, value ) { } function checkPlanFields( explain, matches, n ) { - checkField( "cursor", "BasicCursor" ); - checkField( "n", n ); - checkField( "nscannedObjects", matches ); - checkField( "nscanned", matches ); - checkField( "indexBounds", {} ); + checkField( explain, "cursor", "BasicCursor" ); + checkField( explain, "n", n ); + checkField( explain, "nscannedObjects", matches ); + checkField( explain, "nscanned", matches ); + checkField( explain, "indexBounds", {} ); } function checkFields( matches, sort, limit ) { - it = t.find(); + cursor = t.find(); if ( sort ) { - it.sort({a:1}); + cursor.sort({a:1}); } if ( limit ) { - it.limit( limit ); + cursor.limit( limit ); } - explain = it.explain( true ); + explain = cursor.explain( true ); // printjson( explain ); checkPlanFields( explain, matches, matches > 0 ? 1 : 0 ); - checkField( "scanAndOrder", sort ); - checkField( "millis" ); - checkField( "nYields" ); - checkField( "nChunkSkips", 0 ); - checkField( "isMultiKey", false ); - checkField( "indexOnly", false ); - checkField( "server" ); - checkField( "allPlans" ); - explain.allPlans.forEach( function( x ) { checkPlanFields( x, matches ); } ); + checkField( explain, "scanAndOrder", sort ); + checkField( explain, "millis" ); + checkField( explain, "nYields" ); + checkField( explain, "nChunkSkips", 0 ); + checkField( explain, "isMultiKey", false ); + checkField( explain, "indexOnly", false ); + checkField( explain, "server" ); + checkField( explain, "allPlans" ); + explain.allPlans.forEach( function( x ) { checkPlanFields( x, matches, matches ); } ); } checkFields( 0, false ); |