summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/matcher/schema/expression_internal_schema_max_length.h')
-rw-r--r--src/mongo/db/matcher/schema/expression_internal_schema_max_length.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h b/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h
index eb26a28f897..abe98806e26 100644
--- a/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h
+++ b/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h
@@ -37,10 +37,14 @@ namespace mongo {
class InternalSchemaMaxLengthMatchExpression final : public InternalSchemaStrLengthMatchExpression {
public:
- InternalSchemaMaxLengthMatchExpression(StringData path, long long strLen)
- : InternalSchemaStrLengthMatchExpression(
- MatchType::INTERNAL_SCHEMA_MAX_LENGTH, path, strLen, "$_internalSchemaMaxLength"_sd) {
- }
+ InternalSchemaMaxLengthMatchExpression(StringData path,
+ long long strLen,
+ clonable_ptr<ErrorAnnotation> annotation = nullptr)
+ : InternalSchemaStrLengthMatchExpression(MatchType::INTERNAL_SCHEMA_MAX_LENGTH,
+ path,
+ strLen,
+ "$_internalSchemaMaxLength"_sd,
+ std::move(annotation)) {}
Validator getComparator() const final {
return [strLen = strLen()](int lenWithoutNullTerm) { return lenWithoutNullTerm <= strLen; };
@@ -48,7 +52,8 @@ public:
std::unique_ptr<MatchExpression> shallowClone() const final {
std::unique_ptr<InternalSchemaMaxLengthMatchExpression> maxLen =
- std::make_unique<InternalSchemaMaxLengthMatchExpression>(path(), strLen());
+ std::make_unique<InternalSchemaMaxLengthMatchExpression>(
+ path(), strLen(), _errorAnnotation);
if (getTag()) {
maxLen->setTag(getTag()->clone());
}