summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/catalog/database.cpp8
-rw-r--r--src/mongo/db/commands/dbcommands.cpp12
2 files changed, 12 insertions, 8 deletions
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index 1895acb15f7..feb4111edac 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -683,14 +683,6 @@ Status userCreateNS(OperationContext* txn,
// Validate the collation, if there is one.
if (!collectionOptions.collation.isEmpty()) {
- if (serverGlobalParams.featureCompatibilityVersion.load() ==
- ServerGlobalParams::FeatureCompatibilityVersion_32) {
- return Status(ErrorCodes::InvalidOptions,
- "The featureCompatibilityVersion must be 3.4 to create a collection or "
- "view with a default collation. See "
- "http://dochub.mongodb.org/core/3.4-feature-compatibility.");
- }
-
auto collator = CollatorFactoryInterface::get(txn->getServiceContext())
->makeFromBSON(collectionOptions.collation);
if (!collator.isOK()) {
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 794896db52c..3e8ce384741 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -538,6 +538,18 @@ public:
warning() << deprecationWarning;
result.append("note", deprecationWarning);
}
+
+ auto featureCompatibilityVersion = serverGlobalParams.featureCompatibilityVersion.load();
+ if (ServerGlobalParams::FeatureCompatibilityVersion_32 == featureCompatibilityVersion &&
+ cmdObj.hasField("collation")) {
+ return appendCommandStatus(
+ result,
+ {ErrorCodes::InvalidOptions,
+ "The featureCompatibilityVersion must be 3.4 to create a collection or "
+ "view with a default collation. See "
+ "http://dochub.mongodb.org/core/3.4-feature-compatibility."});
+ }
+
return appendCommandStatus(result, createCollection(txn, dbname, cmdObj));
}
} cmdCreate;