summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-11-21 13:39:14 -0500
committerEliot Horowitz <eliot@10gen.com>2010-11-21 13:39:14 -0500
commit33c79655ab44085865b2210a4196978449140f38 (patch)
treee0dbf541a1179938d01b1a771bb1565e368c5e48
parentce28849411d0436c25e7f3d1c32669655919a02f (diff)
downloadmongo-33c79655ab44085865b2210a4196978449140f38.tar.gz
fix mr temp collection handling with no results
-rw-r--r--db/commands/mr.cpp11
-rw-r--r--jstests/mr_comments.js2
2 files changed, 5 insertions, 8 deletions
diff --git a/db/commands/mr.cpp b/db/commands/mr.cpp
index 58d8ab65660..019a27a4bbe 100644
--- a/db/commands/mr.cpp
+++ b/db/commands/mr.cpp
@@ -207,11 +207,10 @@ namespace mongo {
if ( outType == NORMAL ){
db.dropCollection( finalLong );
- if ( db.count( tempLong ) ){
- BSONObj info;
- uassert( 10076 , "rename failed" ,
- db.runCommand( "admin" , BSON( "renameCollection" << tempLong << "to" << finalLong ) , info ) );
- }
+ BSONObj info;
+ uassert( 10076 , "rename failed" ,
+ db.runCommand( "admin" , BSON( "renameCollection" << tempLong << "to" << finalLong ) , info ) );
+ db.dropCollection( tempLong );
}
else if ( outType == MERGE ){
auto_ptr<DBClientCursor> cursor = db.query( tempLong , BSONObj() );
@@ -520,7 +519,7 @@ namespace mongo {
auto_ptr<DBClientCursor> idx = db.getIndexes( mr.finalLong );
while ( idx->more() ){
BSONObj i = idx->next();
-
+
BSONObjBuilder b( i.objsize() + 16 );
b.append( "ns" , mr.tempLong );
BSONObjIterator j( i );
diff --git a/jstests/mr_comments.js b/jstests/mr_comments.js
index 2962abc5599..77e0f75faa1 100644
--- a/jstests/mr_comments.js
+++ b/jstests/mr_comments.js
@@ -15,7 +15,6 @@ res = db.runCommand(
out: "mr_comments_out"
});
printjson( res );
-db[res.results].drop()
res = db.runCommand(
{ mapreduce : "mr_comments",
@@ -26,5 +25,4 @@ res = db.runCommand(
out: "mr_comments_out"
});
printjson( res );
-db[res.results].drop()