Skip to content

Commit d564df5

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

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

source/includes/options-mongo.yaml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,40 +55,46 @@ 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 not specified, {{program}} attempts to connect to a
60+
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 URI connection string <mongodb-uri>`.
78+
79+
.. code-block:: sh
80+
81+
mongodb://[username:password@]<hostname1>[:port][,<hostname2>[:port]...][/[database][?options]]
82+
83+
- A :ref:`DNS seedlist connection string <connections-dns-seedlist>`.
8884
89-
mongodb+srv://server.example.com/?connectionTimeout=3000ms
85+
.. versionadded:: 3.6
9086
91-
.. versionadded:: 3.6
87+
.. code-block:: sh
88+
89+
mongodb+srv://<hostname>[:port][/[database][?options]]
90+
91+
.. note::
92+
93+
For TLS/SSL connections (``--ssl``), {{program}} verifies that the
94+
hostname of the {{instance}} to which you are connecting matches
95+
the CN or SAN of the {{instance}}'s ``--sslPEMKeyFile``
96+
certificate. If the hostname does not match the CN/SAN, {{program}}
97+
cannot connect to the {{instance}}.
9298
9399
optional: true
94100
replacement:
@@ -329,7 +335,7 @@ description: |
329335
the use of invalid certificates to connect.
330336
331337
.. note::
332-
338+
333339
.. include:: /includes/extracts/ssl-facts-x509-invalid-certificate.rst
334340
335341
.. include:: /includes/extracts/ssl-facts-invalid-cert-warning-clients.rst

0 commit comments

Comments
 (0)