summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/expression.h
diff options
context:
space:
mode:
authorKshitij Gupta <kshitij.gupta@mongodb.com>2020-07-15 15:06:01 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-03 16:33:05 +0000
commitd57e17494ceade881013e2e99606cc92d4a38605 (patch)
tree0aede55cbb5c2751374cef684cc0c21c7117741f /src/mongo/db/pipeline/expression.h
parent9cfe13115e92a43d1b9273ee1d5817d548264ba7 (diff)
downloadmongo-d57e17494ceade881013e2e99606cc92d4a38605.tar.gz
SERVER-49214: Add $toHashedIndexKey expression.
Diffstat (limited to 'src/mongo/db/pipeline/expression.h')
-rw-r--r--src/mongo/db/pipeline/expression.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h
index 862a6a31da6..32b47f4562a 100644
--- a/src/mongo/db/pipeline/expression.h
+++ b/src/mongo/db/pipeline/expression.h
@@ -2908,4 +2908,26 @@ private:
double getRandomValue() const;
};
+
+class ExpressionToHashedIndexKey : public Expression {
+public:
+ ExpressionToHashedIndexKey(ExpressionContext* const expCtx,
+ boost::intrusive_ptr<Expression> inputExpression)
+ : Expression(expCtx, {inputExpression}){};
+
+ static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx,
+ BSONElement expr,
+ const VariablesParseState& vps);
+
+ void acceptVisitor(ExpressionVisitor* visitor) final {
+ return visitor->visit(this);
+ }
+
+ Value evaluate(const Document& root, Variables* variables) const;
+ Value serialize(bool explain) const final;
+
+protected:
+ void _doAddDependencies(DepsTracker* deps) const final;
+};
+
} // namespace mongo