From 64b33ee522375a8dc15be2875dfb7db4502259b0 Mon Sep 17 00:00:00 2001 From: Antonin Kral Date: Sat, 18 Jun 2011 21:24:41 +0200 Subject: Imported Upstream version 1.8.2 --- db/commands/mr.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'db/commands/mr.cpp') diff --git a/db/commands/mr.cpp b/db/commands/mr.cpp index 16c604a..b9f5b59 100644 --- a/db/commands/mr.cpp +++ b/db/commands/mr.cpp @@ -758,7 +758,18 @@ namespace mongo { BSONObj fast_emit( const BSONObj& args ) { uassert( 10077 , "fast_emit takes 2 args" , args.nFields() == 2 ); uassert( 13069 , "an emit can't be more than half max bson size" , args.objsize() < ( BSONObjMaxUserSize / 2 ) ); - (*_tl)->emit( args ); + + if ( args.firstElement().type() == Undefined ) { + BSONObjBuilder b( args.objsize() ); + b.appendNull( "" ); + BSONObjIterator i( args ); + i.next(); + b.append( i.next() ); + (*_tl)->emit( b.obj() ); + } + else { + (*_tl)->emit( args ); + } return BSONObj(); } -- cgit v1.2.3