summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp')
-rw-r--r--src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp
index 263b23cc4e9..31f5812256f 100644
--- a/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp
+++ b/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp
@@ -69,10 +69,16 @@ void InternalSchemaEqMatchExpression::debugString(StringBuilder& debug,
debug << "\n";
}
-BSONObj InternalSchemaEqMatchExpression::getSerializedRightHandSide() const {
- BSONObjBuilder eqObj;
- eqObj.appendAs(_rhsElem, kName);
- return eqObj.obj();
+void InternalSchemaEqMatchExpression::appendSerializedRightHandSide(
+ BSONObjBuilder* bob, const SerializationOptions& opts, bool includePath) const {
+ if (opts.literalPolicy != LiteralSerializationPolicy::kUnchanged && _rhsElem.isABSONObj()) {
+ BSONObjBuilder exprSpec(bob->subobjStart(kName));
+ opts.addHmacedObjToBuilder(&exprSpec, _rhsElem.Obj());
+ exprSpec.doneFast();
+ return;
+ }
+ // If the element is not an object it must be a literal.
+ opts.appendLiteral(bob, kName, _rhsElem);
}
bool InternalSchemaEqMatchExpression::equivalent(const MatchExpression* other) const {