summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_match.h
diff options
context:
space:
mode:
authorJacob Evans <jacob.evans@mongodb.com>2020-02-07 20:31:11 +0000
committerevergreen <evergreen@mongodb.com>2020-02-07 20:31:11 +0000
commit9955e3ab374e26b8428378dfabf94ce89f00aaa6 (patch)
tree89ea915a6b093ff2401627ba394c6444994ffb26 /src/mongo/db/pipeline/document_source_match.h
parent7160266ea5d1cf497570ba77ba148072ab1f6bd3 (diff)
downloadmongo-9955e3ab374e26b8428378dfabf94ce89f00aaa6.tar.gz
SERVER-45530 Implement $match and $project duplication and pushdown across $unionWith
Diffstat (limited to 'src/mongo/db/pipeline/document_source_match.h')
-rw-r--r--src/mongo/db/pipeline/document_source_match.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_match.h b/src/mongo/db/pipeline/document_source_match.h
index a684c4c82f8..ecdda5dc274 100644
--- a/src/mongo/db/pipeline/document_source_match.h
+++ b/src/mongo/db/pipeline/document_source_match.h
@@ -30,16 +30,24 @@
#pragma once
#include <memory>
+#include <type_traits>
#include <utility>
#include "mongo/client/connpool.h"
#include "mongo/db/matcher/matcher.h"
#include "mongo/db/pipeline/document_source.h"
+#include "mongo/util/intrusive_counter.h"
namespace mongo {
class DocumentSourceMatch : public DocumentSource {
public:
+ template <typename T, typename... Args, typename>
+ friend boost::intrusive_ptr<T> make_intrusive(Args&&...);
+ virtual boost::intrusive_ptr<DocumentSourceMatch> clone() const {
+ return make_intrusive<std::decay_t<decltype(*this)>>(*this);
+ }
+
static constexpr StringData kStageName = "$match"_sd;
/**
* Convenience method for creating a $match stage.
@@ -170,6 +178,11 @@ public:
}
protected:
+ DocumentSourceMatch(const DocumentSourceMatch& other)
+ : DocumentSourceMatch(
+ other.serialize().getDocument().toBson().firstElement().embeddedObject(),
+ other.pExpCtx) {}
+
GetNextResult doGetNext() override;
DocumentSourceMatch(const BSONObj& query,
const boost::intrusive_ptr<ExpressionContext>& expCtx);