Files
mongo/jstests/core/remove6.js

41 lines
744 B
JavaScript
Raw Normal View History

t = db.remove6;
t.drop();
2009-11-22 22:52:38 -05:00
N = 1000;
function pop(){
t.drop();
var arr = [];
2009-11-22 22:52:38 -05:00
for ( var i=0; i<N; i++ ){
arr.push( { x : 1 , tags : [ "a" , "b" , "c" ] } );
}
t.insert( arr );
assert.eq( t.count(), N );
}
function del(){
return t.remove( { tags : { $in : [ "a" , "c" ] } } );
}
function test( n , idx ){
pop();
2009-11-22 22:52:38 -05:00
assert.eq( N , t.count() , n + " A " + idx );
if ( idx )
t.ensureIndex( idx );
var res = del();
assert( !res.hasWriteError() , "error deleting: " + res.toString() );
assert.eq( 0 , t.count() , n + " B " + idx );
}
test( "a" );
test( "b" , { x : 1 } );
test( "c" , { tags : 1 } );
2009-11-22 22:52:38 -05:00
N = 5000
test( "a2" );
test( "b2" , { x : 1 } );
test( "c2" , { tags : 1 } );