Skip to content

Commit 8122e11

Browse files
authored
DOCS-12574 specify format for hostnames when using +srv connection string (#2595) (#3286)
* DOCS-12574 specify format for hostnames when using +srv connection string * internal review comments * external review
1 parent 5a09438 commit 8122e11

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

source/reference/connection-string.txt

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,32 @@ query the DNS for the record to determine which hosts are running the
244244
(or the equivalent :urioption:`ssl`) option to ``false`` with
245245
``tls=false`` (or ``ssl=false``) in the query string.
246246

247-
The following example shows a typical connection string for a DNS
248-
:term:`seed list` connection string:
247+
When using the ``+srv`` format, you must specify the ``hostname``,
248+
``domain``, and ``top-level domain (TLD)`` in the following format:
249+
``<hostname>.<domain>.<TLD>.`` This table shows how the placeholders
250+
correspond to example values:
251+
252+
.. list-table::
253+
:header-rows: 1
254+
:widths: 50 50
255+
256+
* - Placeholder
257+
- Example
258+
259+
* - ``<hostname>``
260+
- ``server``
261+
262+
* - ``<domain>``
263+
- ``example``
264+
265+
* - ``<TLD>``
266+
- ``com``
267+
268+
* - ``<hostname>.<domain>.<TLD>``
269+
- ``server.example.com``
270+
271+
This example shows a DNS :term:`seed list` connection string that
272+
correctly uses the ``<hostname>.<domain>.<TLD>`` format.
249273

250274
.. code-block:: none
251275

@@ -259,6 +283,9 @@ The corresponding DNS configuration might resemble:
259283
_mongodb._tcp.server.example.com. 86400 IN SRV 0 5 27317 mongodb1.example.com.
260284
_mongodb._tcp.server.example.com. 86400 IN SRV 0 5 27017 mongodb2.example.com.
261285

286+
Individual SRV records must be in
287+
``_mongodb._tcp.<hostname>.<domain>.<TLD>`` format.
288+
262289
When a client connects to a member of the :term:`seed list`, the client
263290
retrieves a list of replica set members it can connect to. Clients
264291
often use DNS aliases in their seed lists which means the host may
@@ -275,6 +302,17 @@ replica set config.
275302
the parent domains and hostname do not match, you will not be able to
276303
connect.
277304

305+
This example shows a DNS seed list connection string that is missing
306+
the ``<hostname>``. This is incorrect and raises an error.
307+
308+
.. code-block:: none
309+
:copyable: false
310+
311+
# This connection string is missing the <hostname> and raises a connection error
312+
313+
mongodb+srv://example.com/
314+
315+
278316
Like the standard connection string, the DNS seed list connection string
279317
supports specifying options as a query string. With a DNS seed list
280318
connection string, you can *also* specify the following options via a

0 commit comments

Comments
 (0)