summaryrefslogtreecommitdiff
path: root/jstests/sharding/check_sharding_index_versioned.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/check_sharding_index_versioned.js')
-rw-r--r--jstests/sharding/check_sharding_index_versioned.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/jstests/sharding/check_sharding_index_versioned.js b/jstests/sharding/check_sharding_index_versioned.js
index ae5eb461089..57e2ece67e5 100644
--- a/jstests/sharding/check_sharding_index_versioned.js
+++ b/jstests/sharding/check_sharding_index_versioned.js
@@ -17,14 +17,13 @@ assert.commandWorked(st.s.adminCommand({shardCollection: ns, key: {_id: 1}}));
//
// Note the shell connects to shards with a DBClient, which throws StaleConfig errors as JS
// exceptions when the error does not come from a mongos.
-const error = assert.throws(() => {
+assert.throwsWithCode(() => {
st.rs0.getPrimary().getDB(dbName).runCommand({
checkShardingIndex: ns,
keyPattern: {x: 1},
shardVersion: [Timestamp(99, 10101), ObjectId()],
});
-});
-assert.eq(error.code, ErrorCodes.StaleConfig);
+}, ErrorCodes.StaleConfig);
st.stop();
})();