diff options
author | James Wahlin <james.wahlin@10gen.com> | 2017-04-05 09:59:54 -0400 |
---|---|---|
committer | James Wahlin <james.wahlin@10gen.com> | 2017-04-29 09:21:00 -0400 |
commit | 5273c2bad7df58c44afdd677609b8656f399a906 (patch) | |
tree | 0257684f5555293d72e07179c6b058081c247019 /src/mongo/db/pipeline/document_source_graph_lookup.cpp | |
parent | 2e8e60bfef83ac9c7bf494b0f80977686cb1b772 (diff) | |
download | mongo-5273c2bad7df58c44afdd677609b8656f399a906.tar.gz |
SERVER-28651 Move agg var ownership to ExpressionContext
Diffstat (limited to 'src/mongo/db/pipeline/document_source_graph_lookup.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_graph_lookup.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.cpp b/src/mongo/db/pipeline/document_source_graph_lookup.cpp index 7cc78ba8e95..d0c338c0855 100644 --- a/src/mongo/db/pipeline/document_source_graph_lookup.cpp +++ b/src/mongo/db/pipeline/document_source_graph_lookup.cpp @@ -325,9 +325,10 @@ void DocumentSourceGraphLookUp::performSearch() { // Make sure _input is set before calling performSearch(). invariant(_input); - _variables->setRoot(*_input); - Value startingValue = _startWith->evaluateInternal(_variables.get()); - _variables->clearRoot(); + auto& variables = pExpCtx->variables; + variables.setRoot(*_input); + Value startingValue = _startWith->evaluateInternal(); + variables.clearRoot(); // If _startWith evaluates to an array, treat each value as a separate starting point. if (startingValue.isArray()) { @@ -494,7 +495,6 @@ intrusive_ptr<DocumentSourceGraphLookUp> DocumentSourceGraphLookUp::create( depthField, maxDepth, unwindSrc)); - source->_variables.reset(new Variables()); return source; } @@ -509,8 +509,7 @@ intrusive_ptr<DocumentSource> DocumentSourceGraphLookUp::createFromBson( boost::optional<long long> maxDepth; boost::optional<BSONObj> additionalFilter; - VariablesIdGenerator idGenerator; - VariablesParseState vps(&idGenerator); + VariablesParseState vps = expCtx->variablesParseState; for (auto&& argument : elem.Obj()) { const auto argName = argument.fieldNameStringData(); @@ -607,8 +606,6 @@ intrusive_ptr<DocumentSource> DocumentSourceGraphLookUp::createFromBson( maxDepth, boost::none)); - newSource->_variables.reset(new Variables(idGenerator.getIdCount())); - return std::move(newSource); } } // namespace mongo |