summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/view_response_formatter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/view_response_formatter.cpp')
-rw-r--r--src/mongo/db/query/view_response_formatter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/query/view_response_formatter.cpp b/src/mongo/db/query/view_response_formatter.cpp
index 76c8457c8b5..397f5e6769a 100644
--- a/src/mongo/db/query/view_response_formatter.cpp
+++ b/src/mongo/db/query/view_response_formatter.cpp
@@ -28,6 +28,8 @@
*/
#include "mongo/platform/basic.h"
+#include "mongo/util/assert_util.h"
+#include "mongo/util/str.h"
#include "mongo/db/query/view_response_formatter.h"
@@ -57,7 +59,11 @@ Status ViewResponseFormatter::appendAsCountResponse(BSONObjBuilder* resultBuilde
} else {
invariant(cursorFirstBatch.size() == 1);
auto countObj = cursorFirstBatch.back();
- resultBuilder->append(kCountField, countObj["count"].Int());
+ auto countElem = countObj["count"];
+ tassert(9384400,
+ str::stream() << "the 'count' should be of number type, but found " << countElem,
+ countElem.isNumber());
+ resultBuilder->appendAs(countElem, kCountField);
}
resultBuilder->append(kOkField, 1);
return Status::OK();