Files
mongo/jstests/core/in2.js
Randolph Tan 5595b94560 SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
2014-02-28 16:26:33 -05:00

34 lines
745 B
JavaScript

t = db.in2;
function go( name , index ){
t.drop();
t.save( { a : 1 , b : 1 } );
t.save( { a : 1 , b : 2 } );
t.save( { a : 1 , b : 3 } );
t.save( { a : 1 , b : 1 } );
t.save( { a : 2 , b : 2 } );
t.save( { a : 3 , b : 3 } );
t.save( { a : 1 , b : 1 } );
t.save( { a : 2 , b : 1 } );
t.save( { a : 3 , b : 1 } );
if ( index )
t.ensureIndex( index );
assert.eq( 7 , t.find( { a : { $in : [ 1 , 2 ] } } ).count() , name + " A" );
assert.eq( 6 , t.find( { a : { $in : [ 1 , 2 ] } , b : { $in : [ 1 , 2 ] } } ).count() , name + " B" );
}
go( "no index" );
go( "index on a" , { a : 1 } );
go( "index on b" , { b : 1 } );
go( "index on a&b" , { a : 1 , b : 1 } );