diff options
author | Hana Pearlman <hana.pearlman@mongodb.com> | 2021-03-10 14:16:01 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-15 20:13:15 +0000 |
commit | fa66c2f9df10fbb8ef1083a286f45fbf0ec235fa (patch) | |
tree | f17748552cb02cf6b788c682dbeef7ce71b3125a /src/mongo/db/pipeline/document_source_internal_unpack_bucket.h | |
parent | 7d9059301512c911850804ec67bdd0fb45f4067e (diff) | |
download | mongo-fa66c2f9df10fbb8ef1083a286f45fbf0ec235fa.tar.gz |
SERVER-53484: Allow rewrite to push meta predicates past $unpackBucket
Diffstat (limited to 'src/mongo/db/pipeline/document_source_internal_unpack_bucket.h')
-rw-r--r-- | src/mongo/db/pipeline/document_source_internal_unpack_bucket.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h b/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h index 50a1513cc51..18316a1a3e9 100644 --- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h +++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h @@ -32,6 +32,7 @@ #include <set> #include "mongo/db/pipeline/document_source.h" +#include "mongo/db/pipeline/document_source_match.h" namespace mongo { @@ -206,6 +207,16 @@ public: Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) const; /** + * Attempts to split 'match' into two stages, where the first is dependent only on the metaField + * and the second is the remainder, so that applying them in sequence is equivalent to applying + * 'match' once. Will return two intrusive_ptrs to new $match stages. Either pointer may be + * null. If the first is non-null, it will have the metaField renamed from the user defined name + * to 'kBucketMetaFieldName'. + */ + std::pair<boost::intrusive_ptr<DocumentSourceMatch>, boost::intrusive_ptr<DocumentSourceMatch>> + splitMatchOnMetaAndRename(boost::intrusive_ptr<DocumentSourceMatch> match); + + /** * Takes a predicate after $_internalUnpackBucket on a bucketed field as an argument and * attempts to map it to a new predicate on the 'control' field. For example, the predicate * {a: {$gt: 5}} will generate the predicate {control.max.a: {$_internalExprGt: 5}}, which will |