mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
made test more clear MINOR
This commit is contained in:
parent
4c3e7dac60
commit
2b18fa428c
@ -11,21 +11,29 @@ for ( var i=0; i<1000; i++ ){
|
||||
}
|
||||
|
||||
q1 = { tags : "tag6" };
|
||||
q2 = { tags : { $all : [ "tag6" , "tag12" ] } }
|
||||
q2 = { tags : "tag12" };
|
||||
q3 = { tags : { $all : [ "tag6" , "tag12" ] } }
|
||||
|
||||
assert.eq( 120 , t.find( q1 ).itcount() );
|
||||
assert.eq( 60 , t.find( q2 ).itcount() );
|
||||
assert.eq( 120 , t.find( q1 ).itcount() , "q1 a");
|
||||
assert.eq( 120 , t.find( q2 ).itcount() , "q2 a" );
|
||||
assert.eq( 60 , t.find( q3 ).itcount() , "q3 a");
|
||||
|
||||
t.ensureIndex( { tags : 1 } );
|
||||
|
||||
assert.eq( 120 , t.find( q1 ).itcount() );
|
||||
assert.eq( 60 , t.find( q2 ).itcount() );
|
||||
assert.eq( 120 , t.find( q1 ).itcount() , "q1 a");
|
||||
assert.eq( 120 , t.find( q2 ).itcount() , "q2 a" );
|
||||
assert.eq( 60 , t.find( q3 ).itcount() , "q3 a");
|
||||
|
||||
assert.eq( "BtreeCursor tags_1" , t.find( q1 ).explain().cursor );
|
||||
assert.eq( "BtreeCursor tags_1" , t.find( q2 ).explain().cursor );
|
||||
assert.eq( "BtreeCursor tags_1" , t.find( q3 ).explain().cursor );
|
||||
|
||||
scanned1 = t.find(q1).explain().nscanned;
|
||||
scanned2 = t.find(q2).explain().nscanned;
|
||||
scanned3 = t.find(q3).explain().nscanned;
|
||||
|
||||
//assert( scanned2 <= scanned1 , "$all makes query optimizer not work well" );
|
||||
print( "scanned1: " + scanned1 + " scanned2: " + scanned2 + " scanned3: " + scanned3 );
|
||||
|
||||
// $all should just iterate either of the words
|
||||
//assert( scanned3 <= Math.max( scanned1 , scanned2 ) , "$all makes query optimizer not work well" );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user