diff options
author | Ian Boros <ian.boros@10gen.com> | 2019-01-22 12:18:42 -0500 |
---|---|---|
committer | Ian Boros <ian.boros@10gen.com> | 2019-01-31 16:14:44 -0500 |
commit | 69ba97af386b1ef713579c24dd1f8dbcac2fe7dc (patch) | |
tree | 3efb9e13ed0761e072c75b27429455ce209e93c8 /src | |
parent | a31407309c0440c220c81c63d3053910d90ce4e1 (diff) | |
download | mongo-69ba97af386b1ef713579c24dd1f8dbcac2fe7dc.tar.gz |
SERVER-39109 fix case where agg uses illegal field path
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/pipeline/pipeline_d.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index 9be12b669e6..e2a3526984a 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -888,10 +888,12 @@ void PipelineD::addCursorSource(Collection* collection, intrusive_ptr<DocumentSourceCursor> pSource = DocumentSourceCursor::create( collection, std::move(exec), expCtx, failsForExecutionLevelExplain); - // Note the query, sort, and projection for explain. + // Add the cursor to the pipeline first so that it's correctly disposed of as part of the + // pipeline if an exception is thrown during this method. + pipeline->addInitialSource(pSource); + pSource->setQuery(queryObj); pSource->setSort(sortObj); - if (deps.hasNoRequirements()) { pSource->shouldProduceEmptyDocs(); } @@ -908,7 +910,6 @@ void PipelineD::addCursorSource(Collection* collection, pSource->setProjection(deps.toProjection(), deps.toParsedDeps()); } - pipeline->addInitialSource(pSource); } Timestamp PipelineD::getLatestOplogTimestamp(const Pipeline* pipeline) { |