diff options
Diffstat (limited to 'src/mongo/db/commands/create_command.cpp')
-rw-r--r-- | src/mongo/db/commands/create_command.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/commands/create_command.cpp b/src/mongo/db/commands/create_command.cpp index a5539ad816b..a1201e7a7e1 100644 --- a/src/mongo/db/commands/create_command.cpp +++ b/src/mongo/db/commands/create_command.cpp @@ -165,9 +165,14 @@ public: uassert( ErrorCodes::InvalidOptions, timeseriesNotAllowedWith("size"), !cmd.getSize()); uassert(ErrorCodes::InvalidOptions, timeseriesNotAllowedWith("max"), !cmd.getMax()); - uassert(ErrorCodes::InvalidOptions, - timeseriesNotAllowedWith("validator"), - !cmd.getValidator()); + + // The 'timeseries' option may be passed with a 'validator' if a buckets collection + // is being restored. We assume the caller knows what they are doing. + if (!cmd.getNamespace().isTimeseriesBucketsCollection()) { + uassert(ErrorCodes::InvalidOptions, + timeseriesNotAllowedWith("validator"), + !cmd.getValidator()); + } uassert(ErrorCodes::InvalidOptions, timeseriesNotAllowedWith("validationLevel"), !cmd.getValidationLevel()); |