@@ -18,38 +18,40 @@ Use the following options to control various aspects of your
18
18
General Options
19
19
---------------
20
20
21
- .. setting:: --eval <javascript>
21
+ .. program:: mongosh
22
+
23
+ .. option:: --eval <javascript>
22
24
23
25
Evaluates a JavaScript expression that is specified as an argument.
24
26
The |mdb-shell| does not load its own environment when evaluating
25
27
code. As a result, many options of the shell environment are not
26
28
available when using this option.
27
29
28
- .. setting :: --help, -h
30
+ .. option :: --help, -h
29
31
30
32
Returns information on the options and use of the |mdb-shell|.
31
33
32
- .. setting :: --norc
34
+ .. option :: --norc
33
35
34
36
Prevents the shell from sourcing and evaluating
35
37
:file:`~/.mongorc.js` on start up.
36
38
37
- .. setting :: --shell
39
+ .. option :: --shell
38
40
39
41
Enables the shell interface. If you invoke the ``mongosh``
40
42
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.
44
46
45
- .. setting :: --version
47
+ .. option :: --version
46
48
47
49
Returns the |mdb-shell| release number.
48
50
49
51
Connection Options
50
52
------------------
51
53
52
- .. setting :: --host <hostname>
54
+ .. option :: --host <hostname>
53
55
54
56
Specifies the name of the host machine where the
55
57
:binary:`~bin.mongod` or :binary:`~bin.mongos` is running. If this is
@@ -64,9 +66,9 @@ Connection Options
64
66
65
67
<replSetName>/<hostname1><:port>,<hostname2><:port>,<...>
66
68
67
- For TLS/SSL connections (`` --tls` `),
69
+ For TLS/SSL connections (:option:` --tls <--tls> `),
68
70
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
70
72
connection string) matches the ``SAN`` (or, if ``SAN`` is not
71
73
present, the ``CN``) in the certificate presented by the
72
74
:binary:`~bin.mongod` or :binary:`~bin.mongos`. If ``SAN`` is
@@ -90,43 +92,45 @@ Connection Options
90
92
91
93
mongodb+srv://server.example.com/?connectionTimeout=3000ms
92
94
93
- .. setting :: --ipv6
95
+ .. option :: --ipv6
94
96
95
97
Enables IPv6 support. the |mdb-shell| disables IPv6 by default.
96
98
97
99
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>`
99
102
when starting the |mdb-shell|.
100
103
101
104
: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
103
106
``mongod/mongos`` does not enable IPv6 support on the
104
107
``mongod/mongos``. For documentation on enabling IPv6 support on the
105
108
``mongod/mongos``, see :setting:`net.ipv6`.
106
109
107
- .. setting :: --port <port>
110
+ .. option :: --port <port>
108
111
109
112
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
111
115
specified, the |mdb-shell| attempts to connect to port ``27017``.
112
116
113
117
TLS Options
114
118
~~~~~~~~~~~
115
119
116
- .. setting :: --tls
120
+ .. option :: --tls
117
121
118
122
Enables connection to a :binary:`~bin.mongod` or
119
123
:binary:`~bin.mongos` that has |tls-ssl| support enabled.
120
124
121
125
.. include:: /includes/fact-ssl-see-more.rst
122
126
123
- .. setting :: --tlsCertificateKeyFile <filename>
127
+ .. option :: --tlsCertificateKeyFile <filename>
124
128
125
129
Specifies the :file:`.pem` file that contains both the |tls-ssl|
126
130
certificate and key for the :binary:`~bin.mongo` shell. Specify the
127
131
file name of the :file:`.pem` file using relative or absolute paths.
128
132
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
130
134
a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance that
131
135
requires :ref:`client certificates
132
136
<mongo-connect-require-client-certificates-tls>`. That is, the
@@ -138,24 +142,28 @@ TLS Options
138
142
139
143
.. include:: /includes/fact-ssl-see-more.rst
140
144
141
- .. setting :: --tlsCertificateKeyFilePassword <value>
145
+ .. option :: --tlsCertificateKeyFilePassword <value>
142
146
143
147
Specifies the password to de-crypt the certificate-key file (i.e.
144
- `` --tlsCertificateKeyFile` `).
148
+ :option:` --tlsCertificateKeyFile <--tlsCertificateKeyFile> `).
145
149
146
- Use the ``--tlsCertificateKeyFilePassword`` option only if the
150
+ Use the
151
+ :option:`--tlsCertificateKeyFilePassword
152
+ <--tlsCertificateKeyFilePassword>` option only if the
147
153
certificate-key file is encrypted. In all cases, the |mdb-shell|
148
154
redacts the password from all logging and reporting output.
149
155
150
156
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.
153
161
154
162
See :ref:`ssl-certificate-password`.
155
163
156
164
.. include:: /includes/extracts/ssl-facts-see-more.rst
157
165
158
- .. setting :: --tlsCAFile <filename>
166
+ .. option :: --tlsCAFile <filename>
159
167
160
168
Specifies the :file:`.pem` file that contains the root certificate
161
169
chain from the Certificate Authority. This file is used to validate
@@ -167,15 +175,15 @@ TLS Options
167
175
168
176
.. include:: /includes/extracts/ssl-facts-see-more.rst
169
177
170
- .. setting :: --tlsCRLFile <filename>
178
+ .. option :: --tlsCRLFile <filename>
171
179
172
180
Specifies the :file:`.pem` file that contains the Certificate
173
181
Revocation List. Specify the file name of the :file:`.pem` file
174
182
using relative or absolute paths.
175
183
176
184
.. include:: /includes/extracts/ssl-facts-see-more.rst
177
185
178
- .. setting :: --tlsAllowInvalidHostnames
186
+ .. option :: --tlsAllowInvalidHostnames
179
187
180
188
Disables the validation of the hostnames in the certificate presented
181
189
by the :binary:`~bin.mongod`/:binary:`~bin.mongos` instance. Allows
@@ -184,7 +192,7 @@ TLS Options
184
192
185
193
.. include:: /includes/extracts/ssl-facts-see-more.rst
186
194
187
- .. setting :: --tlsAllowInvalidCertificates
195
+ .. option :: --tlsAllowInvalidCertificates
188
196
189
197
.. versionadded:: 4.2
190
198
@@ -195,46 +203,50 @@ TLS Options
195
203
.. note::
196
204
197
205
Starting in MongoDB 4.0, if you specify
198
- ``--tlsAllowInvalidCertificates`` when using x.509
206
+ :option:`--tlsAllowInvalidCertificates
207
+ <--tlsAllowInvalidCertificates>` when using x.509
199
208
authentication, an invalid certificate is only sufficient to
200
209
establish a |tls-ssl| connection but is *insufficient* for
201
210
authentication.
202
211
203
212
.. warning::
204
213
205
214
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.
209
220
210
221
If the |mdb-shell| shell (and other
211
222
: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
215
227
:binary:`~bin.mongod` and :binary:`~bin.mongos` certificates as
216
228
well as to foreign processes posing as valid :binary:`~bin.mongod`
217
229
or :binary:`~bin.mongos` instances. If you only need to disable
218
230
the validation of the hostname in the |tls-ssl| certificates, see
219
- `` --tlsAllowInvalidHostnames` `.
231
+ :option:` --tlsAllowInvalidHostnames <--tlsAllowInvalidHostnames> `.
220
232
221
233
.. include:: /includes/extracts/ssl-facts-see-more.rst
222
234
223
- .. setting :: --tlsCertificateSelector <parameter>=<value>
235
+ .. option :: --tlsCertificateSelector <parameter>=<value>
224
236
225
237
Available on Windows and macOS as an alternative to
226
- `` --tlsCertificateKeyFile` `.
238
+ :option:` --tlsCertificateKeyFile <--tlsCertificateKeyFile> `.
227
239
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.
231
243
232
244
Specifies a certificate property in order to select a matching
233
245
certificate from the operating system's certificate store.
234
246
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:
238
250
239
251
.. list-table::
240
252
:header-rows: 1
@@ -264,7 +276,7 @@ TLS Options
264
276
265
277
.. include:: /includes/fact-certificate-expiry-warning.rst
266
278
267
- .. setting :: --tlsDisabledProtocols <string>
279
+ .. option :: --tlsDisabledProtocols <string>
268
280
269
281
Disables the specified TLS protocols. The option recognizes the
270
282
following protocols:
@@ -286,23 +298,25 @@ TLS Options
286
298
287
299
Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS
288
300
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>`.
290
303
291
304
Authentication Options
292
305
----------------------
293
306
294
- .. setting :: --authenticationDatabase <dbname>
307
+ .. option :: --authenticationDatabase <dbname>
295
308
296
309
Specifies the authentication database where the specified
297
- `` --username` ` has been created. See
310
+ :option:` --username <--username> ` has been created. See
298
311
:ref:`user-authentication-database`.
299
312
300
313
301
- If you do not specify a value for ``--authenticationDatabase``,
314
+ If you do not specify a value for
315
+ :option:`--authenticationDatabase <--authenticationDatabase>`,
302
316
the |mdb-shell| uses the database specified in the connection
303
317
string.
304
318
305
- .. setting :: --authenticationMechanism <name>
319
+ .. option :: --authenticationMechanism <name>
306
320
307
321
*Default*: SCRAM-SHA-1
308
322
@@ -359,41 +373,44 @@ Authentication Options
359
373
`MongoDB Enterprise
360
374
<http://www.mongodb.com/products/mongodb-enterprise-advanced?jmp=docs>`_.
361
375
362
- .. setting :: --gssapiHostName
376
+ .. option :: --gssapiHostName
363
377
364
378
Specify the hostname of a service using
365
379
:manual:`GSSAPI/Kerberos </core/kerberos>`. Only required if the
366
380
hostname of a machine does not match the hostname resolved by DNS.
367
381
368
382
This option is available only in MongoDB Enterprise.
369
383
370
- .. setting :: --gssapiServiceName
384
+ .. option :: --gssapiServiceName
371
385
372
386
Specify the name of the service using
373
387
:manual:`GSSAPI/Kerberos </core/kerberos>`. Only required if the service does not use the default name of ``mongodb``.
374
388
375
389
This option is available only in MongoDB Enterprise.
376
390
377
- .. setting :: --password <password>, -p <password>
391
+ .. option :: --password <password>, -p <password>
378
392
379
393
Specifies a password with which to authenticate to a MongoDB database
380
394
that uses authentication. Use in conjunction with the
381
- ``--username`` and ``--authenticationDatabase`` options.
395
+ :option:`--username <--username>` and
396
+ :option:`--authenticationDatabase <--authenticationDatabase>`
397
+ options.
382
398
383
399
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
385
401
argument.
386
402
387
- .. setting :: --username <username>, -u <username>
403
+ .. option :: --username <username>, -u <username>
388
404
389
405
Specifies a username with which to authenticate to a MongoDB database
390
406
that uses authentication. Use in conjunction with the
391
- ``--password`` and ``--authenticationDatabase`` options.
407
+ :option:`--password <--password>` and
408
+ :option:`--authenticationDatabase <--authenticationDatabase>` options.
392
409
393
410
Session Options
394
411
---------------
395
412
396
- .. setting :: --retryWrites
413
+ .. option :: --retryWrites
397
414
398
415
Enables :manual:`retryable writes </core/retryable-writes/>` as the
399
416
default for sessions in the |mdb-shell|.
0 commit comments