diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index f6ed7c68776..1312927467d 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -1505,14 +1505,13 @@ namespace mongo { } assert( size <= 0x7fffffff ); - BSONObjBuilder b( (int) size ); - int n=0; + + BSONArrayBuilder b( result.subarrayStart( "values" ) ); for ( set::iterator i = map.begin() ; i != map.end(); i++ ){ - b.appendAs( *i , b.numStr( n++ ).c_str() ); + b.append( *i ); } - - result.appendArray( "values" , b.obj() ); - + b.done(); + return true; } diff --git a/db/jsobj.h b/db/jsobj.h index e4cc9f2915c..709c6451101 100644 --- a/db/jsobj.h +++ b/db/jsobj.h @@ -1662,7 +1662,7 @@ namespace mongo { } BSONArrayBuilder& append(const BSONElement& e){ - _b.appendAs(e, num().c_str()); + _b.appendAs(e, num()); return *this; }