Skip to content

Commit 8e6ea83

Browse files
(DOCSP-12202): Add option directives to mongosh options page
1 parent fef4a34 commit 8e6ea83

File tree

1 file changed

+75
-58
lines changed

1 file changed

+75
-58
lines changed

source/reference/options.txt

Lines changed: 75 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,40 @@ Use the following options to control various aspects of your
1818
General Options
1919
---------------
2020

21-
.. setting:: --eval <javascript>
21+
.. program:: mongosh
22+
23+
.. option:: --eval <javascript>
2224

2325
Evaluates a JavaScript expression that is specified as an argument.
2426
The |mdb-shell| does not load its own environment when evaluating
2527
code. As a result, many options of the shell environment are not
2628
available when using this option.
2729

28-
.. setting:: --help, -h
30+
.. option:: --help, -h
2931

3032
Returns information on the options and use of the |mdb-shell|.
3133

32-
.. setting:: --norc
34+
.. option:: --norc
3335

3436
Prevents the shell from sourcing and evaluating
3537
:file:`~/.mongorc.js` on start up.
3638

37-
.. setting:: --shell
39+
.. option:: --shell
3840

3941
Enables the shell interface. If you invoke the ``mongosh``
4042
command and specify a JavaScript file as an argument, or use
41-
``--eval`` to specify JavaScript on the command line, the
42-
``--shell`` option provides the user with a shell prompt after
43-
the file finishes executing.
43+
:option:`--eval <--eval>` to specify JavaScript on the command line,
44+
the :option:`--shell <--shell>` option provides the user with a shell
45+
prompt after the file finishes executing.
4446

45-
.. setting:: --version
47+
.. option:: --version
4648

4749
Returns the |mdb-shell| release number.
4850

4951
Connection Options
5052
------------------
5153

52-
.. setting:: --host <hostname>
54+
.. option:: --host <hostname>
5355

5456
Specifies the name of the host machine where the
5557
:binary:`~bin.mongod` or :binary:`~bin.mongos` is running. If this is
@@ -64,9 +66,9 @@ Connection Options
6466

6567
<replSetName>/<hostname1><:port>,<hostname2><:port>,<...>
6668

67-
For TLS/SSL connections (``--tls``),
69+
For TLS/SSL connections (:option:`--tls <--tls>`),
6870
The |mdb-shell| shell verifies that the hostname
69-
(specified in the ``--host`` option or the
71+
(specified in the :option:`--host <--host>` option or the
7072
connection string) matches the ``SAN`` (or, if ``SAN`` is not
7173
present, the ``CN``) in the certificate presented by the
7274
:binary:`~bin.mongod` or :binary:`~bin.mongos`. If ``SAN`` is
@@ -90,43 +92,45 @@ Connection Options
9092

9193
mongodb+srv://server.example.com/?connectionTimeout=3000ms
9294

93-
.. setting:: --ipv6
95+
.. option:: --ipv6
9496

9597
Enables IPv6 support. the |mdb-shell| disables IPv6 by default.
9698

9799
To connect to a MongoDB cluster via IPv6, you must specify
98-
both ``--ipv6`` *and* ``--host <mongod/mongos IPv6 address>``
100+
both :option:`--ipv6 <--ipv6>` *and*
101+
:option:`--host (mongod/mongos IPv6 address) <--host>`
99102
when starting the |mdb-shell|.
100103

101104
:binary:`~bin.mongod` and :binary:`~bin.mongos` disable IPv6 support
102-
by default. Specifying ``--ipv6`` when connecting to a
105+
by default. Specifying :option:`--ipv6 <--ipv6>` when connecting to a
103106
``mongod/mongos`` does not enable IPv6 support on the
104107
``mongod/mongos``. For documentation on enabling IPv6 support on the
105108
``mongod/mongos``, see :setting:`net.ipv6`.
106109

107-
.. setting:: --port <port>
110+
.. option:: --port <port>
108111

109112
Specifies the port where the :binary:`~bin.mongod` or
110-
:binary:`~bin.mongos` instance is listening. If ``--port`` is not
113+
:binary:`~bin.mongos` instance is listening. If
114+
:option:`--port <--port>` is not
111115
specified, the |mdb-shell| attempts to connect to port ``27017``.
112116

113117
TLS Options
114118
~~~~~~~~~~~
115119

116-
.. setting:: --tls
120+
.. option:: --tls
117121

118122
Enables connection to a :binary:`~bin.mongod` or
119123
:binary:`~bin.mongos` that has |tls-ssl| support enabled.
120124

121125
.. include:: /includes/fact-ssl-see-more.rst
122126

123-
.. setting:: --tlsCertificateKeyFile <filename>
127+
.. option:: --tlsCertificateKeyFile <filename>
124128

125129
Specifies the :file:`.pem` file that contains both the |tls-ssl|
126130
certificate and key for the :binary:`~bin.mongo` shell. Specify the
127131
file name of the :file:`.pem` file using relative or absolute paths.
128132

129-
This option is required when using the ``--tls`` option to connect to
133+
This option is required when using the :option:`--tls <--tls>` option to connect to
130134
a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance that
131135
requires :ref:`client certificates
132136
<mongo-connect-require-client-certificates-tls>`. That is, the
@@ -138,24 +142,28 @@ TLS Options
138142

139143
.. include:: /includes/fact-ssl-see-more.rst
140144

141-
.. setting:: --tlsCertificateKeyFilePassword <value>
145+
.. option:: --tlsCertificateKeyFilePassword <value>
142146

143147
Specifies the password to de-crypt the certificate-key file (i.e.
144-
``--tlsCertificateKeyFile``).
148+
:option:`--tlsCertificateKeyFile <--tlsCertificateKeyFile>`).
145149

146-
Use the ``--tlsCertificateKeyFilePassword`` option only if the
150+
Use the
151+
:option:`--tlsCertificateKeyFilePassword
152+
<--tlsCertificateKeyFilePassword>` option only if the
147153
certificate-key file is encrypted. In all cases, the |mdb-shell|
148154
redacts the password from all logging and reporting output.
149155

150156
If the private key in the PEM file is encrypted and you do not
151-
specify the ``--tlsCertificateKeyFilePassword`` option; the
152-
|mdb-shell| prompts for a passphrase.
157+
specify the
158+
:option:`--tlsCertificateKeyFilePassword
159+
<--tlsCertificateKeyFilePassword>` option; the |mdb-shell| prompts
160+
for a passphrase.
153161

154162
See :ref:`ssl-certificate-password`.
155163

156164
.. include:: /includes/extracts/ssl-facts-see-more.rst
157165

158-
.. setting:: --tlsCAFile <filename>
166+
.. option:: --tlsCAFile <filename>
159167

160168
Specifies the :file:`.pem` file that contains the root certificate
161169
chain from the Certificate Authority. This file is used to validate
@@ -167,15 +175,15 @@ TLS Options
167175

168176
.. include:: /includes/extracts/ssl-facts-see-more.rst
169177

170-
.. setting:: --tlsCRLFile <filename>
178+
.. option:: --tlsCRLFile <filename>
171179

172180
Specifies the :file:`.pem` file that contains the Certificate
173181
Revocation List. Specify the file name of the :file:`.pem` file
174182
using relative or absolute paths.
175183

176184
.. include:: /includes/extracts/ssl-facts-see-more.rst
177185

178-
.. setting:: --tlsAllowInvalidHostnames
186+
.. option:: --tlsAllowInvalidHostnames
179187

180188
Disables the validation of the hostnames in the certificate presented
181189
by the :binary:`~bin.mongod`/:binary:`~bin.mongos` instance. Allows
@@ -184,7 +192,7 @@ TLS Options
184192

185193
.. include:: /includes/extracts/ssl-facts-see-more.rst
186194

187-
.. setting:: --tlsAllowInvalidCertificates
195+
.. option:: --tlsAllowInvalidCertificates
188196

189197
.. versionadded:: 4.2
190198

@@ -195,46 +203,50 @@ TLS Options
195203
.. note::
196204

197205
Starting in MongoDB 4.0, if you specify
198-
``--tlsAllowInvalidCertificates`` when using x.509
206+
:option:`--tlsAllowInvalidCertificates
207+
<--tlsAllowInvalidCertificates>` when using x.509
199208
authentication, an invalid certificate is only sufficient to
200209
establish a |tls-ssl| connection but is *insufficient* for
201210
authentication.
202211

203212
.. warning::
204213

205214
Although available, avoid using the
206-
``--tlsAllowInvalidCertificates`` option if possible. If the use
207-
of ``--tlsAllowInvalidCertificates`` is necessary, only use the
208-
option on systems where intrusion is not possible.
215+
:option:`--tlsAllowInvalidCertificates
216+
<--tlsAllowInvalidCertificates>` option if possible. If the
217+
use of :option:`--tlsAllowInvalidCertificates
218+
<--tlsAllowInvalidCertificates>` is necessary, only
219+
use the option on systems where intrusion is not possible.
209220

210221
If the |mdb-shell| shell (and other
211222
:ref:`mongodb-tools-support-ssl`) runs with the
212-
``--tlsAllowInvalidCertificates`` option, the shell (and other
213-
:ref:`mongodb-tools-support-ssl`) do not attempt to validate the
214-
server certificates. This creates a vulnerability to expired
223+
:option:`--tlsAllowInvalidCertificates
224+
<--tlsAllowInvalidCertificates>` option, the shell (and
225+
other :ref:`mongodb-tools-support-ssl`) do not attempt to validate
226+
the server certificates. This creates a vulnerability to expired
215227
:binary:`~bin.mongod` and :binary:`~bin.mongos` certificates as
216228
well as to foreign processes posing as valid :binary:`~bin.mongod`
217229
or :binary:`~bin.mongos` instances. If you only need to disable
218230
the validation of the hostname in the |tls-ssl| certificates, see
219-
``--tlsAllowInvalidHostnames``.
231+
:option:`--tlsAllowInvalidHostnames <--tlsAllowInvalidHostnames>`.
220232

221233
.. include:: /includes/extracts/ssl-facts-see-more.rst
222234

223-
.. setting:: --tlsCertificateSelector <parameter>=<value>
235+
.. option:: --tlsCertificateSelector <parameter>=<value>
224236

225237
Available on Windows and macOS as an alternative to
226-
``--tlsCertificateKeyFile``.
238+
:option:`--tlsCertificateKeyFile <--tlsCertificateKeyFile>`.
227239

228-
The ``--tlsCertificateKeyFile`` and
229-
``--tlsCertificateSelector`` options are mutually exclusive.
230-
You can only specify one.
240+
The :option:`--tlsCertificateKeyFile <--tlsCertificateKeyFile>` and
241+
:option:`--tlsCertificateSelector <--tlsCertificateSelector>` options
242+
are mutually exclusive. You can only specify one.
231243

232244
Specifies a certificate property in order to select a matching
233245
certificate from the operating system's certificate store.
234246

235-
``--tlsCertificateSelector`` accepts an argument of the format
236-
``<property>=<value>`` where the property can be one of the
237-
following:
247+
:option:`--tlsCertificateSelector <--tlsCertificateSelector>` accepts
248+
an argument of the format ``<property>=<value>`` where the property
249+
can be one of the following:
238250

239251
.. list-table::
240252
:header-rows: 1
@@ -264,7 +276,7 @@ TLS Options
264276

265277
.. include:: /includes/fact-certificate-expiry-warning.rst
266278

267-
.. setting:: --tlsDisabledProtocols <string>
279+
.. option:: --tlsDisabledProtocols <string>
268280

269281
Disables the specified TLS protocols. The option recognizes the
270282
following protocols:
@@ -286,23 +298,25 @@ TLS Options
286298

287299
Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS
288300
1.1+ is available on the system. To enable the
289-
disabled TLS 1.0, specify ``none`` to ``--tlsDisabledProtocols``.
301+
disabled TLS 1.0, specify ``none`` to
302+
:option:`--tlsDisabledProtocols <--tlsDisabledProtocols>`.
290303

291304
Authentication Options
292305
----------------------
293306

294-
.. setting:: --authenticationDatabase <dbname>
307+
.. option:: --authenticationDatabase <dbname>
295308

296309
Specifies the authentication database where the specified
297-
``--username`` has been created. See
310+
:option:`--username <--username>` has been created. See
298311
:ref:`user-authentication-database`.
299312

300313

301-
If you do not specify a value for ``--authenticationDatabase``,
314+
If you do not specify a value for
315+
:option:`--authenticationDatabase <--authenticationDatabase>`,
302316
the |mdb-shell| uses the database specified in the connection
303317
string.
304318

305-
.. setting:: --authenticationMechanism <name>
319+
.. option:: --authenticationMechanism <name>
306320

307321
*Default*: SCRAM-SHA-1
308322

@@ -359,41 +373,44 @@ Authentication Options
359373
`MongoDB Enterprise
360374
<http://www.mongodb.com/products/mongodb-enterprise-advanced?jmp=docs>`_.
361375

362-
.. setting:: --gssapiHostName
376+
.. option:: --gssapiHostName
363377

364378
Specify the hostname of a service using
365379
:manual:`GSSAPI/Kerberos </core/kerberos>`. Only required if the
366380
hostname of a machine does not match the hostname resolved by DNS.
367381

368382
This option is available only in MongoDB Enterprise.
369383

370-
.. setting:: --gssapiServiceName
384+
.. option:: --gssapiServiceName
371385

372386
Specify the name of the service using
373387
:manual:`GSSAPI/Kerberos </core/kerberos>`. Only required if the service does not use the default name of ``mongodb``.
374388

375389
This option is available only in MongoDB Enterprise.
376390

377-
.. setting:: --password <password>, -p <password>
391+
.. option:: --password <password>, -p <password>
378392

379393
Specifies a password with which to authenticate to a MongoDB database
380394
that uses authentication. Use in conjunction with the
381-
``--username`` and ``--authenticationDatabase`` options.
395+
:option:`--username <--username>` and
396+
:option:`--authenticationDatabase <--authenticationDatabase>`
397+
options.
382398

383399
To force the |mdb-shell| to prompt for a password, enter the
384-
``--password`` option as the last option and leave out the
400+
:option:`--password <--password>` option as the last option and leave out the
385401
argument.
386402

387-
.. setting:: --username <username>, -u <username>
403+
.. option:: --username <username>, -u <username>
388404

389405
Specifies a username with which to authenticate to a MongoDB database
390406
that uses authentication. Use in conjunction with the
391-
``--password`` and ``--authenticationDatabase`` options.
407+
:option:`--password <--password>` and
408+
:option:`--authenticationDatabase <--authenticationDatabase>` options.
392409

393410
Session Options
394411
---------------
395412

396-
.. setting:: --retryWrites
413+
.. option:: --retryWrites
397414

398415
Enables :manual:`retryable writes </core/retryable-writes/>` as the
399416
default for sessions in the |mdb-shell|.

0 commit comments

Comments
 (0)