summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/dbcommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/dbcommands.cpp')
-rw-r--r--src/mongo/db/commands/dbcommands.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 0b6f90d0203..b02534cf98c 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -569,6 +569,15 @@ public:
}
}
+ if (cmd->getValidator() || cmd->getValidationLevel() || cmd->getValidationAction()) {
+ // Check for config.settings in the user command since a validator is allowed
+ // internally on this collection but the user may not modify the validator.
+ uassert(ErrorCodes::InvalidOptions,
+ str::stream() << "Document validators not allowed on system collection "
+ << cmd->getNamespace(),
+ cmd->getNamespace() != NamespaceString::kConfigSettingsNamespace);
+ }
+
uassertStatusOK(timeseries::processCollModCommandWithTimeSeriesTranslation(
opCtx, cmd->getNamespace(), *cmd, true, &result));
return true;