summaryrefslogtreecommitdiff
path: root/jstests/sharding/read_pref_with_hedging_mode.js
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2022-11-17 19:04:21 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-17 20:02:18 +0000
commit20d43f94ce5e943971904f65f8abff1e8b67521f (patch)
tree3fef7261394ad0b2078708f89df032b3ecc9d25a /jstests/sharding/read_pref_with_hedging_mode.js
parentbe0adb109bfac64bc1177b7f43eb3a4accb6d3e9 (diff)
downloadmongo-20d43f94ce5e943971904f65f8abff1e8b67521f.tar.gz
SERVER-59302 Remove support in client code for commands wrapped with $query
The shell and internal client used to upconvert commands wrapped in a "$query" or "query" to a well-formed OP_MSG. This behavior is a holdover from when OP_QUERY was supported and is no longer needed.
Diffstat (limited to 'jstests/sharding/read_pref_with_hedging_mode.js')
-rw-r--r--jstests/sharding/read_pref_with_hedging_mode.js20
1 files changed, 8 insertions, 12 deletions
diff --git a/jstests/sharding/read_pref_with_hedging_mode.js b/jstests/sharding/read_pref_with_hedging_mode.js
index 05c890885ee..408d93e4ca7 100644
--- a/jstests/sharding/read_pref_with_hedging_mode.js
+++ b/jstests/sharding/read_pref_with_hedging_mode.js
@@ -16,12 +16,12 @@ assert.commandWorked(st.s.adminCommand({shardCollection: ns, key: {x: 1}}));
// Test "hedge" read preference validation.
assert.commandFailedWithCode(
- testDB.runCommand({query: {count: collName}, $readPreference: {mode: "primary", hedge: {}}}),
+ testDB.runCommand({count: collName, $readPreference: {mode: "primary", hedge: {}}}),
ErrorCodes.InvalidOptions);
assert.commandFailedWithCode(
testDB.runCommand(
- {query: {count: collName}, $readPreference: {mode: "secondaryPreferred", hedge: "_1"}}),
+ {count: collName, $readPreference: {mode: "secondaryPreferred", hedge: "_1"}}),
ErrorCodes.TypeMismatch);
// Test "readHedgingMode" server parameter validation.
@@ -33,21 +33,17 @@ assert.commandWorked(st.s.adminCommand({setParameter: 1, maxTimeMSForHedgedReads
// Test hedging with maxTimeMS.
assert.commandWorked(st.s.getDB(dbName).runCommand(
- {query: {find: collName, maxTimeMS: 1000}, $readPreference: {mode: "nearest", hedge: {}}}));
+ {find: collName, maxTimeMS: 1000, $readPreference: {mode: "nearest", hedge: {}}}));
// Test hedging without maxTimeMS.
-assert.commandWorked(st.s.getDB(dbName).runCommand({
- query: {count: collName},
- $readPreference: {mode: "secondaryPreferred", hedge: {enabled: true}}
-}));
+assert.commandWorked(st.s.getDB(dbName).runCommand(
+ {count: collName, $readPreference: {mode: "secondaryPreferred", hedge: {enabled: true}}}));
// Set "readHedgingMode" to "off", expect no hedging.
st.s.adminCommand({setParameter: 1, readHedgingMode: "off"});
-assert.commandWorked(st.s.getDB(dbName).runCommand({
- query: {distinct: collName, key: "x"},
- $readPreference: {mode: "primaryPreferred", hedge: {}}
-}));
+assert.commandWorked(st.s.getDB(dbName).runCommand(
+ {distinct: collName, key: "x", $readPreference: {mode: "primaryPreferred", hedge: {}}}));
st.stop();
-})();
+})(); \ No newline at end of file