summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/parsed_inclusion_projection.cpp
diff options
context:
space:
mode:
authorJames Wahlin <james.wahlin@10gen.com>2016-11-09 14:14:40 -0500
committerJames Wahlin <james.wahlin@10gen.com>2016-11-15 14:49:34 -0500
commite0b312bbe4f2c50470560b92fbcfbdd3e0471d2f (patch)
tree1c9a133f1f9c6f6f0cf61fee8af3eacff5ee0329 /src/mongo/db/pipeline/parsed_inclusion_projection.cpp
parentc55f35b894f145d14e7f3b4b431f4139c80a3778 (diff)
downloadmongo-e0b312bbe4f2c50470560b92fbcfbdd3e0471d2f.tar.gz
SERVER-26964 Make FieldPath more efficient
Diffstat (limited to 'src/mongo/db/pipeline/parsed_inclusion_projection.cpp')
-rw-r--r--src/mongo/db/pipeline/parsed_inclusion_projection.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/parsed_inclusion_projection.cpp b/src/mongo/db/pipeline/parsed_inclusion_projection.cpp
index 77fccf8107f..abac372be7e 100644
--- a/src/mongo/db/pipeline/parsed_inclusion_projection.cpp
+++ b/src/mongo/db/pipeline/parsed_inclusion_projection.cpp
@@ -206,7 +206,7 @@ void InclusionNode::addComputedField(const FieldPath& path, boost::intrusive_ptr
_orderToProcessAdditionsAndChildren.push_back(fieldName);
return;
}
- addOrGetChild(path.getFieldName(0))->addComputedField(path.tail(), expr);
+ addOrGetChild(path.getFieldName(0).toString())->addComputedField(path.tail(), expr);
}
void InclusionNode::addIncludedField(const FieldPath& path) {
@@ -214,7 +214,7 @@ void InclusionNode::addIncludedField(const FieldPath& path) {
_inclusions.insert(path.fullPath());
return;
}
- addOrGetChild(path.getFieldName(0))->addIncludedField(path.tail());
+ addOrGetChild(path.getFieldName(0).toString())->addIncludedField(path.tail());
}
InclusionNode* InclusionNode::addOrGetChild(std::string field) {
@@ -299,7 +299,7 @@ void ParsedInclusionProjection::parse(const BSONObj& spec,
auto remainingPath = FieldPath(elem.fieldName());
auto child = _root.get();
while (remainingPath.getPathLength() > 1) {
- child = child->addOrGetChild(remainingPath.getFieldName(0));
+ child = child->addOrGetChild(remainingPath.getFieldName(0).toString());
remainingPath = remainingPath.tail();
}
// It is illegal to construct an empty FieldPath, so the above loop ends one
@@ -350,7 +350,7 @@ bool ParsedInclusionProjection::parseObjectAsExpression(
// This is an expression like {$add: [...]}. We have already verified that it has only one
// field.
invariant(objSpec.nFields() == 1);
- _root->addComputedField(pathToObject.toString(),
+ _root->addComputedField(pathToObject,
Expression::parseExpression(objSpec, variablesParseState));
return true;
}