Skip to content

DOCSP-46697: SRV record section #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion source/connect/connection-targets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Choose a Connection Target
:values: reference

.. meta::
:keywords: connection string, URI, server, settings, client, load balancing
:keywords: connection string, URI, server, settings, client, load balancing, srv, dns

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

DNS Service Discovery
---------------------

To use DNS service discovery to look up the DNS SRV record of the service you're connecting to,
specify the SRV connection format in your connection string. Additionally, if you enable
the SRV connection format, {+driver-short+} automatically re-scans for new hosts without
having to change the client configuration.

The following code shows a connection string that uses the SRV connection format:

.. code-block:: python

uri = "mongodb+srv://<hostname>/"

To learn more about the SRV connection format, see the :manual:`SRV Connection Format </reference/connection-string/#std-label-connections-dns-seedlist>`
entry in the {+mdb-server+} manual.

Troubleshooting
---------------

Expand Down
Loading