summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
authorYoonsoo Kim <yoonsoo.kim@mongodb.com>2021-06-28 07:00:07 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-01 22:20:30 +0000
commit71e0a2469126353455d5df3ecce8be103018f933 (patch)
treeac4d13045844821b9cec1aa825aba6e2e9da71fd /jstests/sharding
parente7482d8e7fd1ae6371181abcf2a0661b0f87f3be (diff)
downloadmongo-71e0a2469126353455d5df3ecce8be103018f933.tar.gz
SERVER-57388 Remove readMode/writeMode/rpcProtocols/useLegacyWriteOps shell command-line parameters
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/query/collation_targeting.js180
-rw-r--r--jstests/sharding/query/collation_targeting_inherited.js128
-rw-r--r--jstests/sharding/sharded_limit_batchsize.js3
3 files changed, 128 insertions, 183 deletions
diff --git a/jstests/sharding/query/collation_targeting.js b/jstests/sharding/query/collation_targeting.js
index 8e446f745aa..9b7268518a1 100644
--- a/jstests/sharding/query/collation_targeting.js
+++ b/jstests/sharding/query/collation_targeting.js
@@ -267,16 +267,14 @@ assert.eq(2,
// Remove.
// Test a remove command on strings with non-simple collation. This should be scatter-gather.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.remove({a: "foo"}, {collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(2, writeRes.nRemoved);
- explain = coll.explain().remove({a: "foo"}, {collation: caseInsensitive});
- assert.commandWorked(explain);
- assert.eq(3, explain.queryPlanner.winningPlan.shards.length);
- assert.commandWorked(coll.insert(a_FOO));
- assert.commandWorked(coll.insert(a_foo));
-}
+writeRes = coll.remove({a: "foo"}, {collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(2, writeRes.nRemoved);
+explain = coll.explain().remove({a: "foo"}, {collation: caseInsensitive});
+assert.commandWorked(explain);
+assert.eq(3, explain.queryPlanner.winningPlan.shards.length);
+assert.commandWorked(coll.insert(a_FOO));
+assert.commandWorked(coll.insert(a_foo));
// Test a remove command on strings with simple collation. This should be single-shard.
writeRes = coll.remove({a: "foo"});
@@ -288,15 +286,13 @@ assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
assert.commandWorked(coll.insert(a_foo));
// Test a remove command on numbers with non-simple collation. This should be single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.remove({a: 100}, {collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nRemoved);
- explain = coll.explain().remove({a: 100}, {collation: caseInsensitive});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
- assert.commandWorked(coll.insert(a_100));
-}
+writeRes = coll.remove({a: 100}, {collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nRemoved);
+explain = coll.explain().remove({a: 100}, {collation: caseInsensitive});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
+assert.commandWorked(coll.insert(a_100));
// A single remove (justOne: true) must be single-shard or an exact-ID query. A query is
// exact-ID if it contains an equality on _id and either has the collection default collation or
@@ -304,9 +300,7 @@ if (testDB.getMongo().writeMode() === "commands") {
// Single remove on string shard key with non-simple collation should fail, because it is not
// single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.writeError(coll.remove({a: "foo"}, {justOne: true, collation: caseInsensitive}));
-}
+assert.writeError(coll.remove({a: "foo"}, {justOne: true, collation: caseInsensitive}));
// Single remove on string shard key with simple collation should succeed, because it is
// single-shard.
@@ -320,21 +314,17 @@ assert.commandWorked(coll.insert(a_foo));
// Single remove on number shard key with non-simple collation should succeed, because it is
// single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.remove({a: 100}, {justOne: true, collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nRemoved);
- explain = coll.explain().remove({a: 100}, {justOne: true, collation: caseInsensitive});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
- assert.commandWorked(coll.insert(a_100));
-}
+writeRes = coll.remove({a: 100}, {justOne: true, collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nRemoved);
+explain = coll.explain().remove({a: 100}, {justOne: true, collation: caseInsensitive});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
+assert.commandWorked(coll.insert(a_100));
// Single remove on string _id with non-collection-default collation should fail, because it is
// not an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.writeError(coll.remove({_id: "foo"}, {justOne: true, collation: caseInsensitive}));
-}
+assert.writeError(coll.remove({_id: "foo"}, {justOne: true, collation: caseInsensitive}));
// Single remove on string _id with collection-default collation should succeed, because it is
// an exact-ID query.
@@ -345,34 +335,28 @@ assert.eq(1, writeRes.nRemoved);
// Single remove on string _id with collection-default collation explicitly given should
// succeed, because it is an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.commandWorked(coll.insert({_id: "foo", a: "bar"}));
- writeRes = coll.remove({_id: "foo"}, {justOne: true, collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nRemoved);
-}
+assert.commandWorked(coll.insert({_id: "foo", a: "bar"}));
+writeRes = coll.remove({_id: "foo"}, {justOne: true, collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nRemoved);
// Single remove on number _id with non-collection-default collation should succeed, because it
// is an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.remove({_id: a_100._id}, {justOne: true, collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nRemoved);
- assert.commandWorked(coll.insert(a_100));
-}
+writeRes = coll.remove({_id: a_100._id}, {justOne: true, collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nRemoved);
+assert.commandWorked(coll.insert(a_100));
// Update.
// Test an update command on strings with non-simple collation. This should be scatter-gather.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.update({a: "foo"}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(2, writeRes.nMatched);
- explain = coll.explain().update(
- {a: "foo"}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
- assert.commandWorked(explain);
- assert.eq(3, explain.queryPlanner.winningPlan.shards.length);
-}
+writeRes = coll.update({a: "foo"}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(2, writeRes.nMatched);
+explain =
+ coll.explain().update({a: "foo"}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
+assert.commandWorked(explain);
+assert.eq(3, explain.queryPlanner.winningPlan.shards.length);
// Test an update command on strings with simple collation. This should be single-shard.
writeRes = coll.update({a: "foo"}, {$set: {b: 1}}, {multi: true});
@@ -383,15 +367,13 @@ assert.commandWorked(explain);
assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Test an update command on numbers with non-simple collation. This should be single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.update({a: 100}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- explain =
- coll.explain().update({a: 100}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
-}
+writeRes = coll.update({a: 100}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+explain =
+ coll.explain().update({a: 100}, {$set: {b: 1}}, {multi: true, collation: caseInsensitive});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// A single (non-multi) update must be single-shard or an exact-ID query. A query is exact-ID if
// it contains an equality on _id and either has the collection default collation or _id is not
@@ -399,9 +381,7 @@ if (testDB.getMongo().writeMode() === "commands") {
// Single update on string shard key with non-simple collation should fail, because it is not
// single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.writeError(coll.update({a: "foo"}, {$set: {b: 1}}, {collation: caseInsensitive}));
-}
+assert.writeError(coll.update({a: "foo"}, {$set: {b: 1}}, {collation: caseInsensitive}));
// Single update on string shard key with simple collation should succeed, because it is
// single-shard.
@@ -414,22 +394,18 @@ assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Single update on number shard key with non-simple collation should succeed, because it is
// single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.update({a: 100}, {$set: {b: 1}}, {collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- explain = coll.explain().update({a: 100}, {$set: {b: 1}}, {collation: caseInsensitive});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
-}
+writeRes = coll.update({a: 100}, {$set: {b: 1}}, {collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+explain = coll.explain().update({a: 100}, {$set: {b: 1}}, {collation: caseInsensitive});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Single update on string _id with non-collection-default collation should fail, because it is
// not an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.commandWorked(coll.insert({_id: "foo", a: "bar"}));
- assert.writeError(coll.update({_id: "foo"}, {$set: {b: 1}}, {collation: caseInsensitive}));
- assert.commandWorked(coll.remove({_id: "foo"}, {justOne: true}));
-}
+assert.commandWorked(coll.insert({_id: "foo", a: "bar"}));
+assert.writeError(coll.update({_id: "foo"}, {$set: {b: 1}}, {collation: caseInsensitive}));
+assert.commandWorked(coll.remove({_id: "foo"}, {justOne: true}));
// Single update on string _id with collection-default collation should succeed, because it is
// an exact-ID query.
@@ -441,29 +417,23 @@ assert.commandWorked(coll.remove({_id: "foo"}, {justOne: true}));
// Single update on string _id with collection-default collation explicitly given should
// succeed, because it is an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.commandWorked(coll.insert({_id: "foo", a: "bar"}));
- writeRes = coll.update({_id: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- assert.commandWorked(coll.remove({_id: "foo"}, {justOne: true}));
-}
+assert.commandWorked(coll.insert({_id: "foo", a: "bar"}));
+writeRes = coll.update({_id: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+assert.commandWorked(coll.remove({_id: "foo"}, {justOne: true}));
// Single update on number _id with non-collection-default collation should succeed, because it
// is an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.update({_id: a_foo._id}, {$set: {b: 1}}, {collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
-}
+writeRes = coll.update({_id: a_foo._id}, {$set: {b: 1}}, {collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
// Upsert must always be single-shard.
// Upsert on strings with non-simple collation should fail, because it is not single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.writeError(coll.update(
- {a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true, collation: caseInsensitive}));
-}
+assert.writeError(coll.update(
+ {a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true, collation: caseInsensitive}));
// Upsert on strings with simple collation should succeed, because it is single-shard.
writeRes = coll.update({a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true});
@@ -474,16 +444,14 @@ assert.commandWorked(explain);
assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Upsert on numbers with non-simple collation should succeed, because it is single shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = coll.update(
- {a: 100}, {$set: {b: 1}}, {multi: true, upsert: true, collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- explain = coll.explain().update(
- {a: 100}, {$set: {b: 1}}, {multi: true, upsert: true, collation: caseInsensitive});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
-}
+writeRes =
+ coll.update({a: 100}, {$set: {b: 1}}, {multi: true, upsert: true, collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+explain = coll.explain().update(
+ {a: 100}, {$set: {b: 1}}, {multi: true, upsert: true, collation: caseInsensitive});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
st.stop();
})();
diff --git a/jstests/sharding/query/collation_targeting_inherited.js b/jstests/sharding/query/collation_targeting_inherited.js
index 74ac599dc62..e971bf51629 100644
--- a/jstests/sharding/query/collation_targeting_inherited.js
+++ b/jstests/sharding/query/collation_targeting_inherited.js
@@ -299,15 +299,13 @@ assert.commandWorked(collCaseInsensitive.insert(a_FOO));
assert.commandWorked(collCaseInsensitive.insert(a_foo));
// Test a remove command on strings with simple collation. This should be single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = collCaseInsensitive.remove({a: "foo"}, {collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nRemoved);
- explain = collCaseInsensitive.explain().remove({a: "foo"}, {collation: {locale: "simple"}});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
- assert.commandWorked(collCaseInsensitive.insert(a_foo));
-}
+writeRes = collCaseInsensitive.remove({a: "foo"}, {collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nRemoved);
+explain = collCaseInsensitive.explain().remove({a: "foo"}, {collation: {locale: "simple"}});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
+assert.commandWorked(collCaseInsensitive.insert(a_foo));
// Test a remove command on numbers with non-simple collation inherited from collection default.
// This should be single-shard.
@@ -329,17 +327,14 @@ assert.writeError(collCaseInsensitive.remove({a: "foo"}, {justOne: true}));
// Single remove on string shard key with simple collation should succeed, because it is
// single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes =
- collCaseInsensitive.remove({a: "foo"}, {justOne: true, collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nRemoved);
- explain = collCaseInsensitive.explain().remove({a: "foo"},
- {justOne: true, collation: {locale: "simple"}});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
- assert.commandWorked(collCaseInsensitive.insert(a_foo));
-}
+writeRes = collCaseInsensitive.remove({a: "foo"}, {justOne: true, collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nRemoved);
+explain = collCaseInsensitive.explain().remove({a: "foo"},
+ {justOne: true, collation: {locale: "simple"}});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
+assert.commandWorked(collCaseInsensitive.insert(a_foo));
// Single remove on number shard key with non-simple collation inherited from collection default
// should succeed, because it is single-shard.
@@ -365,13 +360,10 @@ assert.eq(1, writeRes.nRemoved);
// Single remove on string _id with collection-default collation explicitly given should
// succeed, because it is an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.commandWorked(collCaseInsensitive.insert({_id: "foo", a: "bar"}));
- writeRes =
- collCaseInsensitive.remove({_id: "foo"}, {justOne: true, collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nRemoved);
-}
+assert.commandWorked(collCaseInsensitive.insert({_id: "foo", a: "bar"}));
+writeRes = collCaseInsensitive.remove({_id: "foo"}, {justOne: true, collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nRemoved);
// Single remove on number _id with non-collection-default collation should succeed, because it
// is an exact-ID query.
@@ -393,16 +385,14 @@ assert.commandWorked(explain);
assert.eq(3, explain.queryPlanner.winningPlan.shards.length);
// Test an update command on strings with simple collation. This should be single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = collCaseInsensitive.update(
- {a: "foo"}, {$set: {b: 1}}, {multi: true, collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- explain = collCaseInsensitive.explain().update(
- {a: "foo"}, {$set: {b: 1}}, {multi: true, collation: {locale: "simple"}});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
-}
+writeRes = collCaseInsensitive.update(
+ {a: "foo"}, {$set: {b: 1}}, {multi: true, collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+explain = collCaseInsensitive.explain().update(
+ {a: "foo"}, {$set: {b: 1}}, {multi: true, collation: {locale: "simple"}});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Test an update command on numbers with non-simple collation inherited from collection
// default. This should be single-shard.
@@ -424,16 +414,13 @@ assert.writeError(collCaseInsensitive.update({a: "foo"}, {$set: {b: 1}}));
// Single update on string shard key with simple collation should succeed, because it is
// single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes =
- collCaseInsensitive.update({a: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- explain = collCaseInsensitive.explain().update(
- {a: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
-}
+writeRes = collCaseInsensitive.update({a: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+explain = collCaseInsensitive.explain().update(
+ {a: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Single update on number shard key with non-simple collation inherited from collation default
// should succeed, because it is single-shard.
@@ -446,10 +433,8 @@ assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Single update on string _id with non-collection-default collation should fail, because it is
// not an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.writeError(
- collCaseInsensitive.update({_id: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}}));
-}
+assert.writeError(
+ collCaseInsensitive.update({_id: "foo"}, {$set: {b: 1}}, {collation: {locale: "simple"}}));
// Single update on string _id with collection-default collation should succeed, because it is
// an exact-ID query.
@@ -461,23 +446,18 @@ assert.commandWorked(collCaseInsensitive.remove({_id: "foo"}, {justOne: true}));
// Single update on string _id with collection-default collation explicitly given should
// succeed, because it is an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- assert.commandWorked(collCaseInsensitive.insert({_id: "foo", a: "bar"}));
- writeRes =
- collCaseInsensitive.update({_id: "foo"}, {$set: {b: 1}}, {collation: caseInsensitive});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- assert.commandWorked(collCaseInsensitive.remove({_id: "foo"}, {justOne: true}));
-}
+assert.commandWorked(collCaseInsensitive.insert({_id: "foo", a: "bar"}));
+writeRes = collCaseInsensitive.update({_id: "foo"}, {$set: {b: 1}}, {collation: caseInsensitive});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+assert.commandWorked(collCaseInsensitive.remove({_id: "foo"}, {justOne: true}));
// Single update on number _id with non-collection-default collation inherited from collection
// default should succeed, because it is an exact-ID query.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = collCaseInsensitive.update(
- {_id: a_foo._id}, {$set: {b: 1}}, {collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
-}
+writeRes =
+ collCaseInsensitive.update({_id: a_foo._id}, {$set: {b: 1}}, {collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
// Upsert must always be single-shard.
@@ -487,16 +467,14 @@ assert.writeError(
collCaseInsensitive.update({a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true}));
// Upsert on strings with simple collation should succeed, because it is single-shard.
-if (testDB.getMongo().writeMode() === "commands") {
- writeRes = collCaseInsensitive.update(
- {a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true, collation: {locale: "simple"}});
- assert.commandWorked(writeRes);
- assert.eq(1, writeRes.nMatched);
- explain = collCaseInsensitive.explain().update(
- {a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true, collation: {locale: "simple"}});
- assert.commandWorked(explain);
- assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
-}
+writeRes = collCaseInsensitive.update(
+ {a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true, collation: {locale: "simple"}});
+assert.commandWorked(writeRes);
+assert.eq(1, writeRes.nMatched);
+explain = collCaseInsensitive.explain().update(
+ {a: "foo"}, {$set: {b: 1}}, {multi: true, upsert: true, collation: {locale: "simple"}});
+assert.commandWorked(explain);
+assert.eq(1, explain.queryPlanner.winningPlan.shards.length);
// Upsert on numbers with non-simple collation inherited from collection default should succeed,
// because it is single-shard.
diff --git a/jstests/sharding/sharded_limit_batchsize.js b/jstests/sharding/sharded_limit_batchsize.js
index 9113b7dd8ba..2a174fd823d 100644
--- a/jstests/sharding/sharded_limit_batchsize.js
+++ b/jstests/sharding/sharded_limit_batchsize.js
@@ -42,8 +42,7 @@ function testLimit(coll) {
assert.eq(3, cursor.next()["_id"]);
assert(!cursor.hasNext());
- // Ensure that in the limit 1 case, which is special when in legacy readMode, the server
- // does not leave a cursor open.
+ // Ensure that in the limit 1 case the server does not leave a cursor open.
var openCursorsBefore =
assert.commandWorked(coll.getDB().serverStatus()).metrics.cursor.open.total;
cursor = coll.find().sort({x: 1}).limit(1);