From 8a183712823293198067b4d25a8c37c2757c952d Mon Sep 17 00:00:00 2001 From: Joseph Dougherty Date: Thu, 27 Mar 2025 12:55:47 -0400 Subject: [PATCH] DOCSP-48699-directConnection-Docker-admonition --- source/connect.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/connect.txt b/source/connect.txt index f52945f9..bd26037b 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -258,6 +258,17 @@ To connect to a replica set, you can either: - Explicitly specify the replica set name and members in the connection string. +.. important:: + + When a replica set runs in Docker, it might expose only one + MongoDB endpoint. In this case, the replica set is not discoverable, and specifying + ``directConnection=false`` can prevent your application from connecting to it. + + In a test or development environment, you can connect to the replica set by specifying + ``directConnection=true`` in your connection URI. In a production environment, we + recommend configuring the cluster to make each MongoDB instance accessible outside of + the Docker virtual network. + Option 1: DNS Seedlist Format `````````````````````````````