summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-09-08 09:46:46 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-09-08 09:47:07 -0400
commit8428cafa1a3c9ee61963e2289b0d136b169ee517 (patch)
tree2758a791e61380dc1bebf68e846f35eeed7e2ab5 /jstests
parent803d0a0d56690ebb11dead6beb541517a944ef4a (diff)
downloadmongo-8428cafa1a3c9ee61963e2289b0d136b169ee517.tar.gz
SERVER-25741 Disallow collection default collation if featureCompatibilityVersion is 3.2
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthrough/collation_feature_compatibility_version.js19
-rw-r--r--jstests/noPassthrough/index_version_v2.js22
2 files changed, 23 insertions, 18 deletions
diff --git a/jstests/noPassthrough/collation_feature_compatibility_version.js b/jstests/noPassthrough/collation_feature_compatibility_version.js
index df3516b2b3e..2f393c2a99a 100644
--- a/jstests/noPassthrough/collation_feature_compatibility_version.js
+++ b/jstests/noPassthrough/collation_feature_compatibility_version.js
@@ -29,6 +29,25 @@
assert.commandWorked(res);
assert.eq("3.2", res.featureCompatibilityVersion);
+ // We cannot create a collection with a default collation when the featureCompatibilityVersion
+ // is 3.2.
+ assert.commandFailed(
+ collationDB.createCollection("collection", {collation: {locale: "fr_CA"}}));
+
+ // We cannot explicitly give a collection the simple collation as its default when the
+ // featureCompatibilityVersion is 3.2.
+ assert.commandFailed(
+ collationDB.createCollection("collection", {collation: {locale: "simple"}}));
+
+ // We cannot create a view with a default collation when the featureCompatibilityVersion is 3.2.
+ assert.commandFailed(collationDB.runCommand(
+ {create: "view", viewOn: "caseInsensitive", collation: {locale: "fr_CA"}}));
+
+ // We cannot explicitly give a view the simple collation as its default when the
+ // featureCompatibilityVersion is 3.2.
+ assert.commandFailed(collationDB.runCommand(
+ {create: "view", viewOn: "caseInsensitive", collation: {locale: "simple"}}));
+
// All operations reject the collation parameter when the featureCompatibilityVersion is 3.2.
assert.throws(function() {
caseInsensitive.aggregate([], {collation: {locale: "en_US"}});
diff --git a/jstests/noPassthrough/index_version_v2.js b/jstests/noPassthrough/index_version_v2.js
index 3634057354e..0c8681f348b 100644
--- a/jstests/noPassthrough/index_version_v2.js
+++ b/jstests/noPassthrough/index_version_v2.js
@@ -162,10 +162,7 @@
// Test that creating a collection with a non-simple default collation returns an error when the
// featureCompatibilityVersion is 3.2.
- //
- // TODO SERVER-25741: Disallow creating a collection with a collation option and update this
- // test case to assert that the "create" command returns an error.
- assert.commandWorked(testDB.runCommand({create: "collation", collation: {locale: "en"}}));
+ assert.commandFailed(testDB.runCommand({create: "collation", collation: {locale: "en"}}));
// Test that creating an index with a non-simple collation returns an error when the
// featureCompatibilityVersion is 3.2.
@@ -173,31 +170,20 @@
// Test that creating a collection with a non-simple default collation and without an _id index
// succeeds when the featureCompatibilityVersion is 3.2.
- //
- // TODO SERVER-25741: Disallow creating a collection with a collation option and update this
- // test case to assert that the "create" command returns an error.
testDB.collation.drop();
- assert.commandWorked(
+ assert.commandFailed(
testDB.runCommand({create: "collation", collation: {locale: "en"}, autoIndexId: false}));
// Test that creating a collection with a simple default collation and without an _id index
// succeeds when the featureCompatibilityVersion is 3.2.
- //
- // TODO SERVER-25741: Disallow creating a collection with a collation option and update this
- // test case to assert that the "create" command returns an error.
testDB.collation.drop();
- assert.commandWorked(testDB.runCommand(
+ assert.commandFailed(testDB.runCommand(
{create: "collation", collation: {locale: "simple"}, autoIndexId: false}));
// Test that creating a collection with a simple default collation succeeds when the
// featureCompatibilityVersion is 3.2.
- //
- // TODO SERVER-25741: Disallow creating a collection with a collation option and update this
- // test case to assert that the "create" command returns an error.
testDB.collation.drop();
- assert.commandWorked(testDB.runCommand({create: "collation", collation: {locale: "simple"}}));
- indexSpec = getIndexSpecByName(testDB.collation, "_id_");
- assert.eq(1, indexSpec.v, tojson(indexSpec));
+ assert.commandFailed(testDB.runCommand({create: "collation", collation: {locale: "simple"}}));
// Test that creating an index with a simple collation returns an error when the
// featureCompatibilityVersion is 3.2.