Skip to content

Commit 14ed037

Browse files
committed
(DOCS-9808): mongo --host supports connection strings
1 parent 482619f commit 14ed037

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

source/includes/options-mongo.yaml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,40 +55,44 @@ name: host
5555
directive: option
5656
args: <hostname>
5757
description: |
58-
Specifies the name of the host machine where the
59-
{{instance}} is running. If this is not specified,
60-
{{program}} attempts to connect to a MongoDB process running on
61-
the localhost.
58+
Specifies the name of the host machine where the {{instance}} is
59+
running. If this is not specified, {{program}} attempts to connect to
60+
a MongoDB process running on the localhost.
6261
63-
To connect to a replica set, specify the :setting:`replica set name
64-
<~replication.replSetName>` and a seed list of set members. Use the
65-
following form:
62+
To connect to a host machine, specify one of the following:
6663
67-
.. code-block:: none
64+
- The *hostname* of a specific machine
6865
69-
<replSetName>/<hostname1><:port>,<hostname2><:port>,<...>
66+
.. code-block:: none
7067
71-
For TLS/SSL connections (``--ssl``), {{program}} verifies that the
72-
hostname of the {{instance}} to which you are connecting matches
73-
the CN or SAN of the {{instance}}'s ``--sslPEMKeyFile`` certificate.
74-
If the hostname does not match the CN/SAN, {{program}} will fail to
75-
connect.
68+
<hostname>[:port]
7669
77-
For `DNS seedlist connections <https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format/>`_, specify the connection protocol as
78-
``mongodb+srv``, followed by the DNS SRV hostname record and any
79-
options. The ``authSource`` and ``replicaSet`` options, if included in
80-
the connection string, will override any corresponding DNS-configured options
81-
set in the TXT record. Use of the ``mongodb+srv:`` connection string implicitly
82-
enables TLS/SSL (normally set with ``ssl=true``) for the client connection. The
83-
TLS/SSL option can be turned off by setting ``ssl=false`` in the query string.
70+
- A *replica set name* and the *hostname* of at least one member of
71+
the replica set.
8472
85-
Example:
73+
.. code-block:: none
8674
87-
.. code-block:: none
75+
<replSetName>/<hostname1>[:<port>][,<hostname2>[:<port>],...]
76+
77+
- A valid :ref:`mongodb connection string <mongodb-uri>`.
78+
79+
.. code-block:: sh
80+
81+
mongodb://[username:password@]<hostname1>[:port][,<hostname2>[:port]...][/[database][?options]]
8882
89-
mongodb+srv://server.example.com/?connectionTimeout=3000ms
83+
- A :ref:`DNS seedlist connection string <connections-dns-seedlist>`.
9084
91-
.. versionadded:: 3.6
85+
.. code-block:: sh
86+
87+
mongodb+srv://<hostname>[:port][/[database][?options]]
88+
89+
.. note::
90+
91+
For TLS/SSL connections (``--ssl``), {{program}} verifies that the
92+
hostname of the {{instance}} to which you are connecting matches
93+
the CN or SAN of the {{instance}}'s ``--sslPEMKeyFile``
94+
certificate. If the hostname does not match the CN/SAN, {{program}}
95+
will fail to connect.
9296
9397
optional: true
9498
replacement:
@@ -329,7 +333,7 @@ description: |
329333
the use of invalid certificates to connect.
330334
331335
.. note::
332-
336+
333337
.. include:: /includes/extracts/ssl-facts-x509-invalid-certificate.rst
334338
335339
.. include:: /includes/extracts/ssl-facts-invalid-cert-warning-clients.rst

0 commit comments

Comments
 (0)