@@ -230,7 +230,8 @@ struct GetLogCmd {
230230 if (query->ns .first != " admin" ) {
231231 // clang-format off
232232 reply->addDocument ((bob << " ok" << 0.0 <<
233- " errmsg" << " access denied; use admin db" ).obj ());
233+ " errmsg" << " access denied; use admin db" <<
234+ " $err" << " access denied; use admin db" ).obj ());
234235 // clang-format on
235236 return reply;
236237 }
@@ -286,6 +287,7 @@ struct ReplSetGetStatusCmd {
286287 // FIXME: what do we really want to report here?
287288 bob.append (" ok" , 0.0 );
288289 bob.append (" errmsg" , " not really talking to mongodb" );
290+ bob.append (" $err" , " not really talking to mongodb" );
289291
290292 reply->addDocument (bob.obj ());
291293
@@ -536,7 +538,12 @@ ACTOR static Future<Reference<ExtMsgReply>> doFindAndModify(Reference<ExtConnect
536538 bson::BSONObj replyObj = bob.obj ().getOwned ();
537539 reply->addDocument (replyObj);
538540 } catch (Error& e) {
539- reply->addDocument (BSON (" errmsg" << e.what () << " code" << e.code () << " ok" << 1.0 ));
541+ // clang-format off
542+ reply->addDocument (BSON (" errmsg" << e.what () <<
543+ " $err" << e.what () <<
544+ " code" << e.code () <<
545+ " ok" << 1.0 ));
546+ // clang-format on
540547 }
541548
542549 return reply;
@@ -662,7 +669,12 @@ ACTOR static Future<Reference<ExtMsgReply>> doCreateIndexes(Reference<ExtConnect
662669 Void _ = wait (waitForAll (f));
663670 reply->addDocument (BSON (" ok" << 1.0 ));
664671 } catch (Error& e) {
665- reply->addDocument (BSON (" ok" << 0.0 << " errmsg" << e.what () << " code" << e.code ()));
672+ // clang-format off
673+ reply->addDocument (BSON (" ok" << 0.0 <<
674+ " $err" << e.what () <<
675+ " errmsg" << e.what () <<
676+ " code" << e.code ()));
677+ // clang-format on
666678 }
667679 return reply;
668680}
@@ -954,7 +966,12 @@ ACTOR static Future<Reference<ExtMsgReply>> insertAndReply(Reference<ExtConnecti
954966 // one FDB transaction.
955967 bson::BSONArrayBuilder arrayBuilder;
956968 for (int i = 0 ; i < docs.size (); i++) {
957- arrayBuilder << BSON (" index" << i << " code" << e.code () << " errmsg" << e.what ());
969+ // clang-format off
970+ arrayBuilder << BSON (" index" << i <<
971+ " code" << e.code () <<
972+ " $err" << e.what () <<
973+ " errmsg" << e.what ());
974+ // clang-format on
958975 }
959976 reply->addDocument (BSON (" ok" << 1 << " n" << 0 << " writeErrors" << arrayBuilder.arr ()));
960977 }
0 commit comments