summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_single_document_transformation.h
diff options
context:
space:
mode:
authorJacob Evans <jacob.evans@mongodb.com>2020-02-06 23:20:39 +0000
committerevergreen <evergreen@mongodb.com>2020-02-06 23:20:39 +0000
commit942ec3300e82672536f34d8273314c5504ae91fb (patch)
tree33dc2895353078b411cada4be99956a8de6f8b48 /src/mongo/db/pipeline/document_source_single_document_transformation.h
parentf9720bbc2af0aac605f2c0d0bbbef2a9ce2f05c2 (diff)
downloadmongo-942ec3300e82672536f34d8273314c5504ae91fb.tar.gz
SERVER-45530 Implement $match and $project duplication and pushdown across $unionWith
Diffstat (limited to 'src/mongo/db/pipeline/document_source_single_document_transformation.h')
-rw-r--r--src/mongo/db/pipeline/document_source_single_document_transformation.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_single_document_transformation.h b/src/mongo/db/pipeline/document_source_single_document_transformation.h
index 323c628f60e..d983de72021 100644
--- a/src/mongo/db/pipeline/document_source_single_document_transformation.h
+++ b/src/mongo/db/pipeline/document_source_single_document_transformation.h
@@ -29,6 +29,8 @@
#pragma once
+#include <type_traits>
+
#include "mongo/db/pipeline/document_source.h"
#include "mongo/db/pipeline/transformer_interface.h"
@@ -42,6 +44,12 @@ namespace mongo {
*/
class DocumentSourceSingleDocumentTransformation final : public DocumentSource {
public:
+ virtual boost::intrusive_ptr<DocumentSource> clone() const {
+ auto list = DocumentSource::parse(pExpCtx, serialize().getDocument().toBson());
+ invariant(list.size() == 1);
+ return list.front();
+ }
+
DocumentSourceSingleDocumentTransformation(
const boost::intrusive_ptr<ExpressionContext>& pExpCtx,
std::unique_ptr<TransformerInterface> parsedTransform,