diff options
author | Benjamin Murphy <benjamin_murphy@me.com> | 2016-04-01 12:52:21 -0400 |
---|---|---|
committer | Benjamin Murphy <benjamin_murphy@me.com> | 2016-04-04 10:42:17 -0400 |
commit | ae3ee1ceddc8af4a123090f6819d082058f3ea94 (patch) | |
tree | def542656b1a1bb94bf39fa9f2cc122924f6925c /src/mongo/db/pipeline/document_source_unwind.cpp | |
parent | a253c2b42aa124df687b54982283270f33e29994 (diff) | |
download | mongo-ae3ee1ceddc8af4a123090f6819d082058f3ea94.tar.gz |
SERVER-23469 Match on unwind's indexPath is no longer optimized.
Diffstat (limited to 'src/mongo/db/pipeline/document_source_unwind.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_unwind.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/document_source_unwind.cpp b/src/mongo/db/pipeline/document_source_unwind.cpp index 506627cc4dd..bba51298389 100644 --- a/src/mongo/db/pipeline/document_source_unwind.cpp +++ b/src/mongo/db/pipeline/document_source_unwind.cpp @@ -231,8 +231,13 @@ Pipeline::SourceContainer::iterator DocumentSourceUnwind::optimizeAt( if (auto nextMatch = dynamic_cast<DocumentSourceMatch*>((*std::next(itr)).get())) { const bool includeDollarPrefix = false; - std::set<std::string> field = {_unwindPath.getPath(includeDollarPrefix)}; - auto splitMatch = nextMatch->splitSourceBy(field); + std::set<std::string> fields = {_unwindPath.getPath(includeDollarPrefix)}; + + if (_indexPath) { + fields.insert((*_indexPath).getPath(false)); + } + + auto splitMatch = nextMatch->splitSourceBy(fields); invariant(splitMatch.first || splitMatch.second); |