diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-11-09 13:10:30 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-11-09 13:10:30 -0500 |
commit | 76d849e09077d1b3dbd5cad3fe296ca06e91119f (patch) | |
tree | b1dd970f3d81f0e320363eb79473fef2dab85c7c | |
parent | f6d06681413db0efbbca189ddf6e5e7cd6217349 (diff) | |
download | mongo-76d849e09077d1b3dbd5cad3fe296ca06e91119f.tar.gz |
fix drop fallout
-rw-r--r-- | jstests/basic1.js | 2 | ||||
-rw-r--r-- | jstests/indexd.js | 6 | ||||
-rw-r--r-- | jstests/profile1.js | 3 | ||||
-rw-r--r-- | shell/collection.js | 6 |
4 files changed, 9 insertions, 8 deletions
diff --git a/jstests/basic1.js b/jstests/basic1.js index 657eb05b1d6..ecbb0c37941 100644 --- a/jstests/basic1.js +++ b/jstests/basic1.js @@ -1,6 +1,6 @@ t = db.getCollection( "basic1" ); -assert( t.drop() ); +t.drop(); o = { a : 1 }; t.save( o ); diff --git a/jstests/indexd.js b/jstests/indexd.js index c519b81bbd3..33246ad9812 100644 --- a/jstests/indexd.js +++ b/jstests/indexd.js @@ -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({}); diff --git a/jstests/profile1.js b/jstests/profile1.js index 916b511f71a..d9abffe16b7 100644 --- a/jstests/profile1.js +++ b/jstests/profile1.js @@ -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}); diff --git a/shell/collection.js b/shell/collection.js index 3e19e935459..50a24b1de5e 100644 --- a/shell/collection.js +++ b/shell/collection.js @@ -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 ){ |