diff options
Diffstat (limited to 'jstests/core/collection_uuid_drop.js')
| -rw-r--r-- | jstests/core/collection_uuid_drop.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/jstests/core/collection_uuid_drop.js b/jstests/core/collection_uuid_drop.js index 276f591afdf..a3465795292 100644 --- a/jstests/core/collection_uuid_drop.js +++ b/jstests/core/collection_uuid_drop.js @@ -58,13 +58,24 @@ assert.eq(res.actualCollection, null); // The command fails when the provided UUID corresponds to a different collection, even if the // provided namespace does not exist. -coll2.drop(); +assert.commandWorked(testDB.runCommand({drop: coll2.getName()})); res = assert.commandFailedWithCode(testDB.runCommand({drop: coll2.getName(), collectionUUID: uuid}), ErrorCodes.CollectionUUIDMismatch); assert.eq(res.db, testDB.getName()); assert.eq(res.collectionUUID, uuid); assert.eq(res.expectedCollection, coll2.getName()); assert.eq(res.actualCollection, coll.getName()); +assert(!testDB.getCollectionNames().includes(coll2.getName())); + +// The command fails with CollectionUUIDMismatch even if the database does not exist. +const nonexistentDB = testDB.getSiblingDB(testDB.getName() + '_nonexistent'); +res = assert.commandFailedWithCode( + nonexistentDB.runCommand({drop: 'nonexistent', collectionUUID: uuid}), + ErrorCodes.CollectionUUIDMismatch); +assert.eq(res.db, nonexistentDB.getName()); +assert.eq(res.collectionUUID, uuid); +assert.eq(res.expectedCollection, 'nonexistent'); +assert.eq(res.actualCollection, null); // The command fails when the provided UUID corresponds to a different collection, even if the // provided namespace is a view. |
