diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-18 17:02:53 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-18 17:02:53 -0300 |
| commit | 959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch) | |
| tree | acc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/matcher/expression_array.cpp | |
| parent | 76588293975fc059cf076779e4283e6ffaf8afff (diff) | |
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/matcher/expression_array.cpp')
| -rw-r--r-- | src/mongo/db/matcher/expression_array.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/mongo/db/matcher/expression_array.cpp b/src/mongo/db/matcher/expression_array.cpp index cbff0adf1ca..42d30aaf0f1 100644 --- a/src/mongo/db/matcher/expression_array.cpp +++ b/src/mongo/db/matcher/expression_array.cpp @@ -101,10 +101,13 @@ void ElemMatchObjectMatchExpression::debugString(StringBuilder& debug, int inden _sub->debugString(debug, indentationLevel + 1); } -BSONObj ElemMatchObjectMatchExpression::getSerializedRightHandSide() const { - BSONObjBuilder subBob; - _sub->serialize(&subBob, true); - return BSON("$elemMatch" << subBob.obj()); +void ElemMatchObjectMatchExpression::appendSerializedRightHandSide(BSONObjBuilder* bob, + const SerializationOptions& opts, + bool includePath) const { + BSONObjBuilder elemMatchBob = bob->subobjStart("$elemMatch"); + SerializationOptions options = opts; + _sub->serialize(&elemMatchBob, options, true); + elemMatchBob.doneFast(); } MatchExpression::ExpressionOptimizerFunc ElemMatchObjectMatchExpression::getOptimizer() const { @@ -170,14 +173,15 @@ void ElemMatchValueMatchExpression::debugString(StringBuilder& debug, int indent } } -BSONObj ElemMatchValueMatchExpression::getSerializedRightHandSide() const { - BSONObjBuilder emBob; - +void ElemMatchValueMatchExpression::appendSerializedRightHandSide(BSONObjBuilder* bob, + const SerializationOptions& opts, + bool includePath) const { + BSONObjBuilder emBob = bob->subobjStart("$elemMatch"); + SerializationOptions options = opts; for (auto&& child : _subs) { - child->serialize(&emBob, false); + child->serialize(&emBob, options, false); } - - return BSON("$elemMatch" << emBob.obj()); + emBob.doneFast(); } MatchExpression::ExpressionOptimizerFunc ElemMatchValueMatchExpression::getOptimizer() const { @@ -215,8 +219,10 @@ void SizeMatchExpression::debugString(StringBuilder& debug, int indentationLevel } } -BSONObj SizeMatchExpression::getSerializedRightHandSide() const { - return BSON("$size" << _size); +void SizeMatchExpression::appendSerializedRightHandSide(BSONObjBuilder* bob, + const SerializationOptions& opts, + bool includePath) const { + opts.appendLiteral(bob, "$size", _size); } bool SizeMatchExpression::equivalent(const MatchExpression* other) const { |
