summaryrefslogtreecommitdiff
path: root/src/mongo/s/query/cluster_find.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/query/cluster_find.cpp')
-rw-r--r--src/mongo/s/query/cluster_find.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp
index 5db9e202564..7441a613124 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -141,6 +141,14 @@ StatusWith<CursorId> runQueryWithoutRetrying(OperationContext* txn,
params.remotes.resize(shards.size());
for (size_t i = 0; i < shards.size(); ++i) {
const auto& shard = shards[i];
+
+ // The find command cannot be used to query config server content with legacy 3-host config
+ // servers, because the new targeting logic only works for config server replica sets.
+ if (shard->isConfig() && shard->getConnString().type() == ConnectionString::SYNC) {
+ return Status(ErrorCodes::CommandNotSupported,
+ "find command not supported without config server as a replica set");
+ }
+
auto targeter = shard->getTargeter();
auto hostAndPort = targeter->findHost(readPref);
if (!hostAndPort.isOK()) {