diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 81ab2961805dc..9b5cfd26ffdcc 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -99,6 +99,7 @@ #include "mongo/util/duration.h" #include "mongo/util/fail_point.h" #include "mongo/util/scopeguard.h" +#include "mongo/util/net/socket_utils.h" #include @@ -214,6 +215,7 @@ void generateErrorResponse(OperationContext* opCtx, // so we need to reset it to a clean state just to be sure. replyBuilder->reset(); replyBuilder->setCommandReply(exception.toStatus(), extraFields); + replyBuilder->getBodyBuilder().append("host", getHostNameCachedAndPort()); replyBuilder->getBodyBuilder().appendElements(replyMetadata); }