Skip to content
Browse files

easier to debug tests

  • Loading branch information...
1 parent 4a39fd4 commit 65749ebccbc46844ce16848c2ea34fcf1881e960 @erh erh committed
Showing with 11 additions and 4 deletions.
  1. +6 −2 jstests/exists6.js
  2. +1 −0 jstests/or5.js
  3. +2 −1 jstests/queryoptimizer4.js
  4. +2 −1 jstests/queryoptimizer7.js
View
8 jstests/exists6.js
@@ -10,9 +10,13 @@ t.save( {b:null} );
checkExists = function( query ) {
// Index range constraint on 'b' is universal, so a BasicCursor is the default cursor type.
- assert.eq( 'BasicCursor', t.find( query ).explain().cursor );
+ var x = t.find( query ).explain()
+ assert.eq( 'BasicCursor', x.cursor , tojson(x) );
// Index bounds include all elements.
- assert.eq( [ [ { $minElement:1 }, { $maxElement:1 } ] ], t.find( query ).hint( {b:1} ).explain().indexBounds.b );
+
+ var x = t.find( query ).hint( {b:1} ).explain()
+ if ( ! x.indexBounds ) x.indexBounds = {}
+ assert.eq( [ [ { $minElement:1 }, { $maxElement:1 } ] ], x.indexBounds.b , tojson(x) );
// All keys must be scanned.
assert.eq( 3, t.find( query ).hint( {b:1} ).explain().nscanned );
// 2 docs will match.
View
1 jstests/or5.js
@@ -6,6 +6,7 @@ t.ensureIndex( {b:1} );
assert.eq.automsg( "'BasicCursor'", "t.find( {$or:[{a:2},{b:3},{}]} ).explain().cursor" );
assert.eq.automsg( "'BasicCursor'", "t.find( {$or:[{a:2},{b:3},{c:4}]} ).explain().cursor" );
+printjson( t.find( {$or:[{a:2},{b:3}]} ).sort( {c:1} ).explain() );
assert.eq.automsg( "'BasicCursor'", "t.find( {$or:[{a:2},{b:3}]} ).sort( {c:1} ).explain().cursor" );
e = t.find( {$or:[{a:2},{b:3}]} ).sort( {a:1} ).explain();
assert.eq.automsg( "'BtreeCursor a_1'", "e.cursor" );
View
3 jstests/queryoptimizer4.js
@@ -24,7 +24,8 @@ function reset( matches, filler ) {
function checkCursor( query, cursor ) {
t.find(query).itcount();
// Check that index on 'cursor' was chosen in the above query.
- assert.eq( 'BtreeCursor ' + cursor, t.find(query).explain(true).oldPlan.cursor );
+ var x = t.find(query).explain(true);
+ assert.eq( 'BtreeCursor ' + cursor, x.oldPlan.cursor , tojson(x) );
}
// Check {b:1} takes over when {a:1} is much worse for query {a:100,b:100}.
View
3 jstests/queryoptimizer7.js
@@ -3,7 +3,8 @@
t = db.jstests_queryoptimizer7;
function assertPlanWasRecorded( query ) {
- assert.eq( 'BtreeCursor a_1', t.find( query ).explain( true ).oldPlan.cursor );
+ var x = t.find( query ).explain( true );
+ assert.eq( 'BtreeCursor a_1', x.oldPlan.cursor , tojson(x) );
}
function assertNoPlanWasRecorded( query ) {

0 comments on commit 65749eb

Please sign in to comment.
Something went wrong with that request. Please try again.