From d0d19f97cfcae7e7115d1efe8eb7933d9a88e14c Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Sat, 7 Nov 2009 21:00:15 -0500 Subject: [PATCH] handle edge case --- db/mr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/mr.cpp b/db/mr.cpp index a0583ee22e4..e19940e877d 100644 --- a/db/mr.cpp +++ b/db/mr.cpp @@ -149,8 +149,10 @@ namespace mongo { if ( finalLong != tempLong ){ dblock l; db.dropCollection( finalLong ); - BSONObj info; - uassert( "rename failed" , db.runCommand( "admin" , BSON( "renameCollection" << tempLong << "to" << finalLong ) , info ) ); + if ( db.count( tempLong ) ){ + BSONObj info; + uassert( "rename failed" , db.runCommand( "admin" , BSON( "renameCollection" << tempLong << "to" << finalLong ) , info ) ); + } } return db.count( finalLong ); }