summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_path.h
diff options
context:
space:
mode:
authorJames Wahlin <james@mongodb.com>2019-01-15 16:56:21 -0500
committerJames Wahlin <james@mongodb.com>2019-02-19 09:13:35 -0500
commitf74085d9935953ccfef6547ab5fdb2db48096828 (patch)
treef35f518a8d367100d396cc61b3fea9079914cca3 /src/mongo/db/matcher/expression_path.h
parentb5bfc89e28b0c7432c8356d4af9b45b14e29138d (diff)
downloadmongo-f74085d9935953ccfef6547ab5fdb2db48096828.tar.gz
SERVER-39019 Fix incorrect $elemMatch $ne serialization
Diffstat (limited to 'src/mongo/db/matcher/expression_path.h')
-rw-r--r--src/mongo/db/matcher/expression_path.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_path.h b/src/mongo/db/matcher/expression_path.h
index 0eccdeb56fd..274aa16d57c 100644
--- a/src/mongo/db/matcher/expression_path.h
+++ b/src/mongo/db/matcher/expression_path.h
@@ -118,6 +118,18 @@ public:
}
}
+ void serialize(BSONObjBuilder* out) const override {
+ out->append(path(), getSerializedRightHandSide());
+ }
+
+ /**
+ * Returns a BSONObj that represents the right-hand-side of a PathMatchExpression. Used for
+ * serialization of PathMatchExpression in cases where we do not want to serialize the path in
+ * line with the expression. For example {x: {$not: {$eq: 1}}}, where $eq is the
+ * PathMatchExpression.
+ */
+ virtual BSONObj getSerializedRightHandSide() const = 0;
+
protected:
void _doAddDependencies(DepsTracker* deps) const final {
if (!_path.empty()) {