diff options
author | Benety Goh <benety@mongodb.com> | 2021-12-03 21:56:03 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-04 03:20:39 +0000 |
commit | cd2787ff5e94fc051750b0d7f0700c93fe867f6a (patch) | |
tree | ddb4893af8b791dca816f454af529e93708cb0fe /jstests | |
parent | 48eb54377e8df6abac0c62f276840a16bd772376 (diff) | |
download | mongo-cd2787ff5e94fc051750b0d7f0700c93fe867f6a.tar.gz |
SERVER-61486 add test case for non-existent namespace for unique index conversion
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/collmod_convert_to_unique.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/core/collmod_convert_to_unique.js b/jstests/core/collmod_convert_to_unique.js index 44c2a907509..997ce289e9e 100644 --- a/jstests/core/collmod_convert_to_unique.js +++ b/jstests/core/collmod_convert_to_unique.js @@ -54,6 +54,13 @@ assert.commandFailedWithCode(db.runCommand({ }), ErrorCodes.BadValue); +// Tries to modify a non-existent collection. +assert.commandFailedWithCode(db.runCommand({ + collMod: collName + '_missing', + index: {keyPattern: {a: 1}, unique: true}, +}), + ErrorCodes.NamespaceNotFound); + // Conversion should fail when there are existing duplicates. assert.commandWorked(coll.insert({_id: 1, a: 100})); assert.commandWorked(coll.insert({_id: 2, a: 100})); |