summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllison Easton <allison.easton@mongodb.com>2023-05-11 16:12:39 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-11 18:45:42 +0000
commitf9de98ae11d27a246632cd9b5148ef2ad08cd40b (patch)
tree18072769f8e18b3c81240e2133bbbded162465d4
parente4ddf04d04f39b2e319ce30b1570a78d0bfa7173 (diff)
downloadmongo-f9de98ae11d27a246632cd9b5148ef2ad08cd40b.tar.gz
SERVER-77027 Only check for direct shard connections if sharding is enabled
-rw-r--r--src/mongo/db/service_entry_point_common.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 05cb0f17155..801a57e184c 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -1729,7 +1729,8 @@ void ExecCommandDatabase::_initiateCommand() {
// Check that the client has the directShardOperations role if this is a direct operation to a
// shard.
- if (command->requiresAuth() && serverGlobalParams.featureCompatibility.isVersionInitialized() &&
+ if (command->requiresAuth() && ShardingState::get(opCtx)->enabled() &&
+ serverGlobalParams.featureCompatibility.isVersionInitialized() &&
feature_flags::gCheckForDirectShardOperations.isEnabled(
serverGlobalParams.featureCompatibility)) {
bool clusterHasTwoOrMoreShards = [&]() {