2009-11-19 10:03:42 -05:00
|
|
|
|
|
|
|
|
t = db.remove6;
|
|
|
|
|
t.drop();
|
|
|
|
|
|
2009-11-22 22:52:38 -05:00
|
|
|
N = 1000;
|
|
|
|
|
|
2009-11-19 10:03:42 -05:00
|
|
|
function pop(){
|
|
|
|
|
t.drop();
|
2014-08-07 11:08:05 -04:00
|
|
|
var arr = [];
|
2009-11-22 22:52:38 -05:00
|
|
|
for ( var i=0; i<N; i++ ){
|
2014-08-07 11:08:05 -04:00
|
|
|
arr.push( { x : 1 , tags : [ "a" , "b" , "c" ] } );
|
2009-11-19 10:03:42 -05:00
|
|
|
}
|
2014-08-07 11:08:05 -04:00
|
|
|
t.insert( arr );
|
|
|
|
|
assert.eq( t.count(), N );
|
2009-11-19 10:03:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function del(){
|
2014-02-19 12:45:53 -05:00
|
|
|
return t.remove( { tags : { $in : [ "a" , "c" ] } } );
|
2009-11-19 10:03:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test( n , idx ){
|
|
|
|
|
pop();
|
2009-11-22 22:52:38 -05:00
|
|
|
assert.eq( N , t.count() , n + " A " + idx );
|
2009-11-19 10:03:42 -05:00
|
|
|
if ( idx )
|
|
|
|
|
t.ensureIndex( idx );
|
2014-02-19 12:45:53 -05:00
|
|
|
var res = del();
|
2014-03-14 15:21:49 -04:00
|
|
|
assert( !res.hasWriteError() , "error deleting: " + res.toString() );
|
2009-11-19 10:03:42 -05:00
|
|
|
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 } );
|
|
|
|
|
|