summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/coll_mod.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2017-10-02 17:24:03 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2017-10-05 16:47:26 -0400
commitcb9f7cdcb7eb6ad9077ac8af3a4c0d7275c7e34f (patch)
tree24fea4c596a4652a457bc496d34a5590b7882190 /src/mongo/db/catalog/coll_mod.cpp
parente02285559b5f15be6afbf876f169874bd9008b0b (diff)
downloadmongo-cb9f7cdcb7eb6ad9077ac8af3a4c0d7275c7e34f.tar.gz
SERVER-30731 Add expr support in MatchExpression outside of aggregation
Diffstat (limited to 'src/mongo/db/catalog/coll_mod.cpp')
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index 1a24d9a8caa..2d7e6e60538 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -175,19 +175,20 @@ StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx,
if (!serverGlobalParams.featureCompatibility.validateFeaturesAsMaster.load() ||
serverGlobalParams.featureCompatibility.version.load() !=
ServerGlobalParams::FeatureCompatibility::Version::k34) {
- // Allow $jsonSchema only if the feature compatibility version is newer than 3.4.
- // Note that we don't enforce this restriction on the secondary or on backup
- // instances, as indicated by !validateFeaturesAsMaster.
+ // Allow $jsonSchema and $expr only if the feature compatibility version is newer
+ // than 3.4. Note that we don't enforce this restriction on secondary instances, as
+ // indicated by !validateFeaturesAsMaster.
allowedFeatures |= MatchExpressionParser::kJSONSchema;
+ allowedFeatures |= MatchExpressionParser::kExpr;
}
auto statusW = coll->parseValidator(opCtx, e.Obj(), allowedFeatures);
if (!statusW.isOK()) {
- if (statusW.getStatus().code() == ErrorCodes::JSONSchemaNotAllowed) {
- // The default error message for disallowed $jsonSchema is not descriptive
- // enough, so we rewrite it here.
- return {ErrorCodes::JSONSchemaNotAllowed,
+ if (statusW.getStatus().code() == ErrorCodes::QueryFeatureNotAllowed) {
+ // The default error message for disallowed $jsonSchema and $expr is not
+ // descriptive enough, so we rewrite it here.
+ return {ErrorCodes::QueryFeatureNotAllowed,
str::stream() << "The featureCompatibilityVersion must be 3.6 to add a "
- "$jsonSchema validator to a collection. See "
+ "collection validator using 3.6 query features. See "
<< feature_compatibility_version::kDochubLink
<< "."};
} else {