Skip to content

Commit 894e587

Browse files
authored
DOCSP-46697: SRV record section (#186)
1 parent 39f0059 commit 894e587

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

source/connect/connection-targets.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Choose a Connection Target
99
:values: reference
1010

1111
.. meta::
12-
:keywords: connection string, URI, server, settings, client, load balancing
12+
:keywords: connection string, URI, server, settings, client, load balancing, srv, dns
1313

1414
.. contents:: On this page
1515
:local:
@@ -151,6 +151,23 @@ option to ``True``. You can do this in two ways: by passing an argument to the
151151
"directConnection=true")
152152
client = MongoClient(uri)
153153

154+
DNS Service Discovery
155+
---------------------
156+
157+
To use DNS service discovery to look up the DNS SRV record of the service you're connecting to,
158+
specify the SRV connection format in your connection string. Additionally, if you enable
159+
the SRV connection format, {+driver-short+} automatically re-scans for new hosts without
160+
having to change the client configuration.
161+
162+
The following code shows a connection string that uses the SRV connection format:
163+
164+
.. code-block:: python
165+
166+
uri = "mongodb+srv://<hostname>/"
167+
168+
To learn more about the SRV connection format, see the :manual:`SRV Connection Format </reference/connection-string/#std-label-connections-dns-seedlist>`
169+
entry in the {+mdb-server+} manual.
170+
154171
Troubleshooting
155172
---------------
156173

0 commit comments

Comments
 (0)