summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/add_fields_projection_executor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/add_fields_projection_executor.cpp')
-rw-r--r--src/mongo/db/exec/add_fields_projection_executor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/exec/add_fields_projection_executor.cpp b/src/mongo/db/exec/add_fields_projection_executor.cpp
index ec3acc136bc..962666132bc 100644
--- a/src/mongo/db/exec/add_fields_projection_executor.cpp
+++ b/src/mongo/db/exec/add_fields_projection_executor.cpp
@@ -280,14 +280,14 @@ void AddFieldsProjectionExecutor::parseSubObject(const BSONObj& subObj,
const VariablesParseState& variablesParseState,
InclusionNode* node) {
for (auto&& elem : subObj) {
- invariant(elem.fieldName()[0] != '$');
+ std::string fieldName = elem.fieldName();
+ invariant(fieldName[0] != '$');
// Dotted paths in a sub-object have already been detected and disallowed by the function
// ProjectionSpecValidator::validate().
- invariant(elem.fieldNameStringData().find('.') == std::string::npos);
+ invariant(fieldName.find('.') == std::string::npos);
if (elem.type() == BSONType::Object) {
// This is either an expression, or a nested specification.
- auto fieldName = elem.fieldNameStringData().toString();
if (!parseObjectAsExpression(
FieldPath::getFullyQualifiedPath(node->getPath(), fieldName),
elem.Obj(),