diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2016-09-06 15:31:11 -0400 |
---|---|---|
committer | Kyle Suarez <kyle.suarez@mongodb.com> | 2016-09-06 15:40:32 -0400 |
commit | 792342e2bcae24607b5ddca54e18c00c637d4f83 (patch) | |
tree | 6d6017c9f5298bf12a867dac14fe2f177689f4bc /jstests/views | |
parent | f515afc5dd533dc2ddc3d80697d9ff96709f9f0d (diff) | |
download | mongo-792342e2bcae24607b5ddca54e18c00c637d4f83.tar.gz |
SERVER-25186 check view collation during create/collMod
Users cannot create/modify a view that overrides the collation of another view.
Diffstat (limited to 'jstests/views')
-rw-r--r-- | jstests/views/views_collation.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/jstests/views/views_collation.js b/jstests/views/views_collation.js index 4ea9bcd913d..4dfe3e59d55 100644 --- a/jstests/views/views_collation.js +++ b/jstests/views/views_collation.js @@ -221,6 +221,39 @@ viewsDB.runCommand( {aggregate: "simpleCollection", pipeline: [lookupFilView, graphLookupSimpleView]}), ErrorCodes.OptionNotSupportedOnView); + + // You cannot create a view that depends on another view with a different default collation. + assert.commandFailedWithCode( + viewsDB.runCommand({create: "zhView", viewOn: "filView", collation: {locale: "zh"}}), + ErrorCodes.OptionNotSupportedOnView); + assert.commandFailedWithCode(viewsDB.runCommand({ + create: "zhView", + viewOn: "simpleCollection", + pipeline: [lookupFilView], + collation: {locale: "zh"} + }), + ErrorCodes.OptionNotSupportedOnView); + assert.commandFailedWithCode(viewsDB.runCommand({ + create: "zhView", + viewOn: "simpleCollection", + pipeline: [graphLookupSimpleView], + collation: {locale: "zh"} + }), + ErrorCodes.OptionNotSupportedOnView); + + // You cannot modify a view to depend on another view with a different default collation. + assert.commandWorked(viewsDB.runCommand( + {create: "esView", viewOn: "simpleCollection", collation: {locale: "es"}})); + assert.commandFailedWithCode(viewsDB.runCommand({collMod: "esView", viewOn: "filView"}), + ErrorCodes.OptionNotSupportedOnView); + assert.commandFailedWithCode( + viewsDB.runCommand( + {collMod: "esView", viewOn: "simpleCollection", pipeline: [lookupSimpleView]}), + ErrorCodes.OptionNotSupportedOnView); + assert.commandFailedWithCode( + viewsDB.runCommand( + {collMod: "esView", viewOn: "simpleCollection", pipeline: [graphLookupFilView]}), + ErrorCodes.OptionNotSupportedOnView); } // Run the test on a standalone. |