summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/canonical_query.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/canonical_query.h')
-rw-r--r--src/mongo/db/query/canonical_query.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/db/query/canonical_query.h b/src/mongo/db/query/canonical_query.h
index 3cacc3b4c9d..39ed4e927f5 100644
--- a/src/mongo/db/query/canonical_query.h
+++ b/src/mongo/db/query/canonical_query.h
@@ -133,6 +133,20 @@ public:
}
/**
+ * Returns a bitset indicating what metadata has been requested in the query.
+ */
+ const QueryMetadataBitSet& metadataDeps() const {
+ return _metadataDeps;
+ }
+
+ /**
+ * Allows callers to request metadata in addition to that needed as part of the query.
+ */
+ void requestAdditionalMetadata(const QueryMetadataBitSet& additionalDeps) {
+ _metadataDeps |= additionalDeps;
+ }
+
+ /**
* Compute the "shape" of this query by encoding the match, projection and sort, and stripping
* out the appropriate values.
*/
@@ -210,6 +224,9 @@ private:
boost::optional<projection_ast::Projection> _proj;
+ // Keeps track of what metadata has been explicitly requested.
+ QueryMetadataBitSet _metadataDeps;
+
std::unique_ptr<CollatorInterface> _collator;
bool _canHaveNoopMatchNodes = false;