summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_facet.h
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2016-08-12 14:51:32 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2016-08-16 14:22:26 -0400
commit7f87288de1dd99adbecb1d0ece1c29871e72410f (patch)
treefe0ab8fdca418af4f97e0ad992769a5a5ff3e35d /src/mongo/db/pipeline/document_source_facet.h
parent2ab0505a4eb805f56d9ec2b721977691e6d2036d (diff)
downloadmongo-7f87288de1dd99adbecb1d0ece1c29871e72410f.tar.gz
SERVER-25584 Ensure $facet and $bucketAuto run on merging shard.
Diffstat (limited to 'src/mongo/db/pipeline/document_source_facet.h')
-rw-r--r--src/mongo/db/pipeline/document_source_facet.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/document_source_facet.h b/src/mongo/db/pipeline/document_source_facet.h
index a6ac631c327..267ebe58bb2 100644
--- a/src/mongo/db/pipeline/document_source_facet.h
+++ b/src/mongo/db/pipeline/document_source_facet.h
@@ -57,7 +57,8 @@ class Pipeline;
* TODO SERVER-24154: Should inherit from SplittableDocumentSource so that it can split in a sharded
* cluster.
*/
-class DocumentSourceFacet final : public DocumentSourceNeedsMongod {
+class DocumentSourceFacet final : public DocumentSourceNeedsMongod,
+ public SplittableDocumentSource {
public:
static boost::intrusive_ptr<DocumentSource> createFromBson(
BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& pExpCtx);
@@ -95,6 +96,16 @@ public:
*/
void setSource(DocumentSource* source) final;
+ /**
+ * The $facet stage must be run on the merging shard.
+ */
+ boost::intrusive_ptr<DocumentSource> getShardSource() final {
+ return nullptr;
+ }
+ boost::intrusive_ptr<DocumentSource> getMergeSource() final {
+ return this;
+ }
+
// The following are overridden just to forward calls to sub-pipelines.
void addInvolvedCollections(std::vector<NamespaceString>* collections) const final;
void doInjectMongodInterface(std::shared_ptr<MongodInterface> mongod) final;