diff options
author | James Wahlin <james@mongodb.com> | 2019-01-15 16:56:21 -0500 |
---|---|---|
committer | James Wahlin <james@mongodb.com> | 2019-02-19 09:13:35 -0500 |
commit | f74085d9935953ccfef6547ab5fdb2db48096828 (patch) | |
tree | f35f518a8d367100d396cc61b3fea9079914cca3 /src/mongo/db/matcher/expression_path.h | |
parent | b5bfc89e28b0c7432c8356d4af9b45b14e29138d (diff) | |
download | mongo-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.h | 12 |
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()) { |