diff options
author | David Storch <david.storch@10gen.com> | 2016-07-19 17:40:02 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-07-20 16:22:05 -0400 |
commit | 60379c1daaaf50d90d240a0ae5b4c6fdad7b4c36 (patch) | |
tree | 45353f17a3a8ee311621a4e65132c66b41789b94 /jstests/core | |
parent | dd26139af00fb1af308d579de6aee802f3856578 (diff) | |
download | mongo-60379c1daaaf50d90d240a0ae5b4c6fdad7b4c36.tar.gz |
SERVER-25136 allow index types which do not support collation on a collection with a non-simple default collation
The application must use {locale: "simple"} to override the
default in this case.
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/collation.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/core/collation.js b/jstests/core/collation.js index ac1ed93d406..bb16e4ab0c4 100644 --- a/jstests/core/collation.js +++ b/jstests/core/collation.js @@ -245,6 +245,21 @@ assert(planHasStage(explainRes.queryPlanner.winningPlan, "IXSCAN")); } + // Should not be possible to create a text index with an explicit non-simple collation. + coll.drop(); + assert.commandFailed(coll.createIndex({a: "text"}, {collation: {locale: "en"}})); + + // Text index builds which inherit a non-simple default collation should fail. + coll.drop(); + assert.commandWorked(db.createCollection(coll.getName(), {collation: {locale: "en"}})); + assert.commandFailed(coll.createIndex({a: "text"})); + + // Text index build should succeed on a collection with a non-simple default collation if it + // explicitly overrides the default with {locale: "simple"}. + coll.drop(); + assert.commandWorked(db.createCollection(coll.getName(), {collation: {locale: "en"}})); + assert.commandWorked(coll.createIndex({a: "text"}, {collation: {locale: "simple"}})); + // // Collation tests for aggregation. // |