summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/collection_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/collection_impl.cpp')
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 28a16f136db..dae6600d637 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -268,7 +268,9 @@ Status CollectionImpl::checkValidation(OperationContext* opCtx, const BSONObj& d
StatusWithMatchExpression CollectionImpl::parseValidator(
OperationContext* opCtx,
const BSONObj& validator,
- MatchExpressionParser::AllowedFeatureSet allowedFeatures) const {
+ MatchExpressionParser::AllowedFeatureSet allowedFeatures,
+ boost::optional<ServerGlobalParams::FeatureCompatibility::Version>
+ maxFeatureCompatibilityVersion) const {
if (validator.isEmpty())
return {nullptr};
@@ -294,6 +296,9 @@ StatusWithMatchExpression CollectionImpl::parseValidator(
// owned by the Collection and will outlive the OperationContext they were created under.
expCtx->opCtx = nullptr;
+ // Enforce a maximum feature version if requested.
+ expCtx->maxFeatureCompatibilityVersion = maxFeatureCompatibilityVersion;
+
auto statusWithMatcher =
MatchExpressionParser::parse(validator, expCtx, ExtensionsCallbackNoop(), allowedFeatures);
if (!statusWithMatcher.isOK())