summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2023-03-07 17:00:10 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-03-21 21:10:30 +0000
commited293ecd0716a1aa4eaa311cf1850af6f93e6dc3 (patch)
treeb8af0ef0a5756359b803ecb18cdce0f15ad04d91 /jstests
parent0f6baedfbb04cd0f1434d091b5ff9e23a6da15c9 (diff)
downloadmongo-ed293ecd0716a1aa4eaa311cf1850af6f93e6dc3.tar.gz
SERVER-74674 Fix type checking getDB in feature_flag_util.js
(cherry picked from commit 7b4c5da7b605e6194524ddd3488c5c175886d94c)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/feature_flag_util.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/jstests/libs/feature_flag_util.js b/jstests/libs/feature_flag_util.js
index 4ebb5ef23be..62f2b74f123 100644
--- a/jstests/libs/feature_flag_util.js
+++ b/jstests/libs/feature_flag_util.js
@@ -32,7 +32,13 @@ var FeatureFlagUtil = class {
} catch (err) {
// Some db-like objects (e.g. ShardingTest.shard0) aren't supported by FixtureHelpers,
// but we can replace it with an object that should work and try again.
- setConn(db.getDB(db.defaultDB));
+ if (typeof db.getDB === typeof Function) {
+ setConn(db.getDB(db.defaultDB));
+ } else {
+ // Some db-like objects (e.g ShardedClusterFixture) have a getSiblingDB method
+ // instead of getDB, use that here to avoid an undefined error.
+ setConn(db.getSiblingDB(db.defaultDB));
+ }
}
if (user) {