summaryrefslogtreecommitdiff
path: root/jstests/sharding/hash_shard_unique_compound.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/hash_shard_unique_compound.js')
-rw-r--r--jstests/sharding/hash_shard_unique_compound.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/jstests/sharding/hash_shard_unique_compound.js b/jstests/sharding/hash_shard_unique_compound.js
index acec60bf667..460d28789b9 100644
--- a/jstests/sharding/hash_shard_unique_compound.js
+++ b/jstests/sharding/hash_shard_unique_compound.js
@@ -21,7 +21,7 @@ assert.commandWorked(db.adminCommand({enablesharding: dbName}));
assert.commandWorked(db.adminCommand({shardcollection: ns, key: {a: "hashed"}}));
// Create unique index
-assert.commandWorked(coll.createIndex({a: 1, b: 1}, {unique: true}));
+assert.commandWorked(coll.ensureIndex({a: 1, b: 1}, {unique: true}));
jsTest.log("------ indexes -------");
jsTest.log(tojson(coll.getIndexes()));
@@ -31,7 +31,7 @@ jsTest.log("------ dropping sharded collection to start part 2 -------");
coll.drop();
// Create unique index
-assert.commandWorked(coll.createIndex({a: 1, b: 1}, {unique: true}));
+assert.commandWorked(coll.ensureIndex({a: 1, b: 1}, {unique: true}));
// shard a fresh collection using a hashed shard key
assert.commandWorked(db.adminCommand({shardcollection: ns, key: {a: "hashed"}}),