Permalink
Browse files

fix drop fallout

  • Loading branch information...
1 parent f6d0668 commit 76d849e09077d1b3dbd5cad3fe296ca06e91119f @erh erh committed Nov 9, 2009
Showing with 9 additions and 8 deletions.
  1. +1 −1 jstests/basic1.js
  2. +2 −4 jstests/indexd.js
  3. +1 −2 jstests/profile1.js
  4. +5 −1 shell/collection.js
View
@@ -1,6 +1,6 @@
t = db.getCollection( "basic1" );
-assert( t.drop() );
+t.drop();
o = { a : 1 };
t.save( o );
View
@@ -4,9 +4,7 @@ t.drop();
t.save( { a : 1 } );
t.ensureIndex( { a : 1 } );
-db.indexd.$_id_.drop();
-r = t.drop();
-assert.eq( 1 , r.ok , "drop failed: " + tojson( r ) );
-
+assert.throws( function(){ db.indexd.$_id_.drop(); } );
+assert( t.drop() );
//db.indexd.$_id_.remove({});
View
@@ -14,8 +14,7 @@ assert.gt(capped_size, 999, "D");
assert.lt(capped_size, 2000, "E");
/* Make sure we can't drop if profiling is still on */
-db.getCollection("system.profile").drop();
-assert(db.getLastError(), "Y");
+assert.throws( function(z){ db.getCollection("system.profile").drop(); } )
/* With pre-created system.profile (un-capped) */
db.runCommand({profile: 0});
View
@@ -296,8 +296,12 @@ DBCollection.prototype.dropIndexes = function(){
DBCollection.prototype.drop = function(){
this.resetIndexCache();
var ret = this._db.runCommand( { drop: this.getName() } );
- if ( ! ret.ok )
+ if ( ! ret.ok ){
+ if ( ret.errmsg == "ns not found" )
+ return false;
throw "drop failed: " + tojson( ret );
+ }
+ return true;
}
DBCollection.prototype.renameCollection = function( newName ){

0 comments on commit 76d849e

Please sign in to comment.