diff options
author | Haley Connelly <haley.connelly@mongodb.com> | 2021-10-29 18:08:50 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-29 19:08:33 +0000 |
commit | 6df5ff6a933e11275ccece75d1708c17d726ddb1 (patch) | |
tree | 761b279b4f5fc6ae29482534813de9af6ecc7953 | |
parent | 9a45a31425255e6a93f187e884257e4eabd3c2f9 (diff) | |
download | mongo-6df5ff6a933e11275ccece75d1708c17d726ddb1.tar.gz |
SERVER-61019 Make deep copy in ClusteredCollectionUtil.constructFullCreateOptions
-rw-r--r-- | jstests/libs/clustered_collection_util.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/jstests/libs/clustered_collection_util.js b/jstests/libs/clustered_collection_util.js index 1e6d9f18bcd..c6760ac0e52 100644 --- a/jstests/libs/clustered_collection_util.js +++ b/jstests/libs/clustered_collection_util.js @@ -17,7 +17,7 @@ var ClusteredCollectionUtil = class { // Returns a copy of the 'createOptions' used to create the clustered collection with default // values for fields absent in the user provided 'createOptions'. static constructFullCreateOptions(createOptions) { - const fullCreateOptions = createOptions; + const fullCreateOptions = Object.extend({}, createOptions, /* deep copy */ true); // If the createOptions don't specify the name, expect the default. if (!createOptions.clusteredIndex.name) { @@ -49,10 +49,11 @@ var ClusteredCollectionUtil = class { } // The clusteredIndex should appear in listIndexes with additional "clustered" field. - static validateListIndexes(db, collName, fullCreationOptions) { + static validateListIndexes(db, collName, createOptions) { + const fullCreateOptions = ClusteredCollectionUtil.constructFullCreateOptions(createOptions); const listIndexes = assert.commandWorked(db[collName].runCommand("listIndexes")); const expectedListIndexesOutput = - Object.extend({clustered: true}, fullCreationOptions.clusteredIndex); + Object.extend({clustered: true}, fullCreateOptions.clusteredIndex); assert.docEq(listIndexes.cursor.firstBatch[0], expectedListIndexesOutput); } |