diff options
author | Antonin Kral <a.kral@bobek.cz> | 2010-01-31 08:32:52 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2010-01-31 08:32:52 +0100 |
commit | 4eefaf421bfeddf040d96a3dafb12e09673423d7 (patch) | |
tree | cb2e5ccc7f98158894f977ff131949da36673591 /jstests/remove6.js | |
download | mongodb-4eefaf421bfeddf040d96a3dafb12e09673423d7.tar.gz |
Imported Upstream version 1.3.1
Diffstat (limited to 'jstests/remove6.js')
-rw-r--r-- | jstests/remove6.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/jstests/remove6.js b/jstests/remove6.js new file mode 100644 index 0000000..d843aee --- /dev/null +++ b/jstests/remove6.js @@ -0,0 +1,38 @@ + +t = db.remove6; +t.drop(); + +N = 1000; + +function pop(){ + t.drop(); + for ( var i=0; i<N; i++ ){ + t.save( { x : 1 , tags : [ "a" , "b" , "c" ] } ); + } +} + +function del(){ + t.remove( { tags : { $in : [ "a" , "c" ] } } ); +} + +function test( n , idx ){ + pop(); + assert.eq( N , t.count() , n + " A " + idx ); + if ( idx ) + t.ensureIndex( idx ); + del(); + var e = db.getLastError(); + assert( e == null , "error deleting: " + e ); + assert.eq( 0 , t.count() , n + " B " + idx ); +} + +test( "a" ); +test( "b" , { x : 1 } ); +test( "c" , { tags : 1 } ); + +N = 5000 + +test( "a2" ); +test( "b2" , { x : 1 } ); +test( "c2" , { tags : 1 } ); + |