diff options
author | Xin Hao Zhang <xinhao.zhang@mongodb.com> | 2019-06-03 17:54:21 -0400 |
---|---|---|
committer | Xin Hao Zhang <xinhao.zhang@mongodb.com> | 2019-06-05 14:10:20 -0400 |
commit | d5d674930f1c67f6c87d73715f82f608668d72fa (patch) | |
tree | fa68f6c6bc6252bfdce7123b945078f10af96bff /jstests/core/create_indexes.js | |
parent | d8e2c4748fda6fc24ea0d1bb1541ea9c66f5e1cf (diff) | |
download | mongo-d5d674930f1c67f6c87d73715f82f608668d72fa.tar.gz |
SERVER-41263 Disallow empty string in index key type
Diffstat (limited to 'jstests/core/create_indexes.js')
-rw-r--r-- | jstests/core/create_indexes.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/jstests/core/create_indexes.js b/jstests/core/create_indexes.js index 45db4c9ef76..c5e7d46de97 100644 --- a/jstests/core/create_indexes.js +++ b/jstests/core/create_indexes.js @@ -166,6 +166,10 @@ res = t.runCommand('createIndexes', {indexes: [{key: {star: 1}, name: '*'}]}); assert.commandFailedWithCode(res, ErrorCodes.BadValue); + // Test that index creation fails with an index value of empty string. + res = t.runCommand('createIndexes', {indexes: [{key: {f: ""}, name: 'f_1'}]}); + assert.commandFailedWithCode(res, ErrorCodes.CannotCreateIndex); + // Test that user is not allowed to create indexes in config.transactions. var configDB = db.getSiblingDB('config'); res = configDB.runCommand( |