diff options
Diffstat (limited to 'src/mongo/db/pipeline/document_source_sort.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_sort.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source_sort.cpp index 475897471ed..aa48535f810 100644 --- a/src/mongo/db/pipeline/document_source_sort.cpp +++ b/src/mongo/db/pipeline/document_source_sort.cpp @@ -524,13 +524,14 @@ int DocumentSourceSort::compare(const Value& lhs, const Value& rhs) const { return 0; } -intrusive_ptr<DocumentSource> DocumentSourceSort::getShardSource() { - return this; -} - -NeedsMergerDocumentSource::MergingLogic DocumentSourceSort::mergingLogic() { - return {_limitSrc ? DocumentSourceLimit::create(pExpCtx, _limitSrc->getLimit()) : nullptr, - sortKeyPattern(SortKeySerialization::kForSortKeyMerging).toBson()}; +boost::optional<DocumentSource::MergingLogic> DocumentSourceSort::mergingLogic() { + MergingLogic split; + split.shardsStage = this; + split.inputSortPattern = sortKeyPattern(SortKeySerialization::kForSortKeyMerging).toBson(); + if (_limitSrc) { + split.mergingStage = DocumentSourceLimit::create(pExpCtx, _limitSrc->getLimit()); + } + return split; } bool DocumentSourceSort::canRunInParallelBeforeOut( |