@@ -23,8 +23,9 @@ General Options
23
23
.. option:: --eval <javascript>
24
24
25
25
Evaluates a JavaScript expression that is specified as an argument.
26
- :program:`mongo` does not load its own environment when evaluating code.
27
- As a result many options of the shell environment are not available.
26
+ :program:`mongo` does not load its own environment when evaluating
27
+ code. As a result many options of the shell environment are not
28
+ available.
28
29
29
30
.. option:: --help, -h
30
31
@@ -38,7 +39,7 @@ General Options
38
39
39
40
Prevents the shell from sourcing and evaluating ``~/.mongorc.js`` on
40
41
startup.
41
-
42
+
42
43
.. option:: --version
43
44
44
45
Returns the |mdb-shell| release number.
@@ -52,15 +53,15 @@ Connection Options
52
53
:binary:`~bin.mongod` or :binary:`~bin.mongos` is running. If this is
53
54
not specified, the |mdb-shell| attempts to connect to a MongoDB
54
55
process running on the localhost.
55
-
56
+
56
57
To connect to a replica set,
57
58
Specify the :setting:`replica set name <~replication.replSetName>`
58
59
and a seed list of set members. Use the following form:
59
-
60
+
60
61
.. code-block:: none
61
-
62
+
62
63
<replSetName>/<hostname1><:port>,<hostname2><:port>,<...>
63
-
64
+
64
65
For TLS/SSL connections (:option:`--tls <--tls>`),
65
66
The |mdb-shell| shell verifies that the hostname
66
67
(specified in the :option:`--host <--host>` option or the
@@ -70,7 +71,7 @@ Connection Options
70
71
present, the |mdb-shell| does not match against the ``CN``. If
71
72
the hostname does not match the ``SAN`` (or ``CN``), the
72
73
|mdb-shell| shell fails to connect.
73
-
74
+
74
75
For `DNS seedlist connections <https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format/>`_,
75
76
Specify the connection protocol as ``mongodb+srv``, followed by
76
77
the DNS SRV hostname record and any options. The ``authSource``
@@ -82,9 +83,9 @@ Connection Options
82
83
setting ``tls=false`` in the query string.
83
84
84
85
.. example::
85
-
86
+
86
87
.. code-block:: none
87
-
88
+
88
89
mongodb+srv://server.example.com/?connectionTimeout=3000ms
89
90
90
91
.. option:: --port <port>
@@ -98,18 +99,18 @@ TLS Options
98
99
~~~~~~~~~~~
99
100
100
101
.. option:: --tls
101
-
102
+
102
103
Enables connection to a :binary:`~bin.mongod` or
103
104
:binary:`~bin.mongos` that has |tls-ssl| support enabled.
104
-
105
+
105
106
.. include:: /includes/fact-ssl-see-more.rst
106
107
107
108
.. option:: --tlsCertificateKeyFile <filename>
108
-
109
+
109
110
Specifies the :file:`.pem` file that contains both the |tls-ssl|
110
111
certificate and key for the :binary:`~bin.mongo` shell. Specify the
111
112
file name of the :file:`.pem` file using relative or absolute paths.
112
-
113
+
113
114
This option is required when using the :option:`--tls <--tls>` option to connect to
114
115
a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance that
115
116
requires :ref:`client certificates
@@ -119,76 +120,76 @@ TLS Options
119
120
.. note::
120
121
121
122
.. include:: /includes/fact-certificate-expiry-warning.rst
122
-
123
+
123
124
.. include:: /includes/fact-ssl-see-more.rst
124
125
125
126
.. option:: --tlsCertificateKeyFilePassword <value>
126
-
127
+
127
128
Specifies the password to de-crypt the certificate-key file (i.e.
128
129
:option:`--tlsCertificateKeyFile <--tlsCertificateKeyFile>`).
129
-
130
+
130
131
Use the
131
132
:option:`--tlsCertificateKeyFilePassword
132
133
<--tlsCertificateKeyFilePassword>` option only if the
133
134
certificate-key file is encrypted. In all cases, the |mdb-shell|
134
135
redacts the password from all logging and reporting output.
135
-
136
+
136
137
If the private key in the PEM file is encrypted and you do not
137
138
specify the
138
139
:option:`--tlsCertificateKeyFilePassword
139
140
<--tlsCertificateKeyFilePassword>` option; the |mdb-shell| prompts
140
141
for a passphrase.
141
-
142
+
142
143
See :ref:`ssl-certificate-password`.
143
-
144
+
144
145
.. include:: /includes/extracts/ssl-facts-see-more.rst
145
146
146
147
.. option:: --tlsCAFile <filename>
147
-
148
+
148
149
Specifies the :file:`.pem` file that contains the root certificate
149
150
chain from the Certificate Authority. This file is used to validate
150
151
the certificate presented by the
151
152
:binary:`~bin.mongod`/:binary:`~bin.mongos` instance.
152
-
153
+
153
154
Specify the file name of the :file:`.pem` file using relative or
154
155
absolute paths.
155
-
156
+
156
157
.. include:: /includes/extracts/ssl-facts-see-more.rst
157
158
158
159
.. option:: --tlsCRLFile <filename>
159
-
160
+
160
161
Specifies the :file:`.pem` file that contains the Certificate
161
162
Revocation List. Specify the file name of the :file:`.pem` file
162
163
using relative or absolute paths.
163
-
164
+
164
165
.. include:: /includes/extracts/ssl-facts-see-more.rst
165
166
166
167
.. option:: --tlsAllowInvalidHostnames
167
-
168
+
168
169
Disables the validation of the hostnames in the certificate presented
169
170
by the :binary:`~bin.mongod`/:binary:`~bin.mongos` instance. Allows
170
171
the |mdb-shell| to connect to MongoDB instances even if the hostname
171
172
in the server certificates do not match the server's host.
172
-
173
+
173
174
.. include:: /includes/extracts/ssl-facts-see-more.rst
174
175
175
176
.. option:: --tlsAllowInvalidCertificates
176
177
177
178
.. versionadded:: 4.2
178
-
179
+
179
180
Bypasses the validation checks for the certificates presented by the
180
181
:binary:`~bin.mongod`/:binary:`~bin.mongos` instance and allows
181
182
connections to servers that present invalid certificates.
182
-
183
+
183
184
.. note::
184
-
185
+
185
186
Starting in MongoDB 4.0, if you specify
186
187
:option:`--tlsAllowInvalidCertificates
187
188
<--tlsAllowInvalidCertificates>` when using x.509
188
189
authentication, an invalid certificate is only sufficient to
189
190
establish a |tls-ssl| connection but is *insufficient* for
190
191
authentication.
191
-
192
+
192
193
.. warning::
193
194
194
195
Although available, avoid using the
@@ -209,32 +210,41 @@ TLS Options
209
210
or :binary:`~bin.mongos` instances. If you only need to disable
210
211
the validation of the hostname in the |tls-ssl| certificates, see
211
212
:option:`--tlsAllowInvalidHostnames <--tlsAllowInvalidHostnames>`.
212
-
213
+
213
214
.. include:: /includes/extracts/ssl-facts-see-more.rst
214
215
215
216
.. option:: --tlsCertificateSelector <parameter>=<value>
216
-
217
+
217
218
Available on Windows and macOS as an alternative to
218
219
:option:`--tlsCertificateKeyFile <--tlsCertificateKeyFile>`.
219
-
220
+
221
+ .. important:: Windows and Importing Private Keys
222
+
223
+ When you import your private key, you must mark it as exportable.
224
+ The Windows **Certificate Import Wizard** doesn't check this
225
+ option by default.
226
+
227
+ .. figure:: /images/certificate-import-wizard.png
228
+ :alt: Microsoft Certificate Import Wizard where the key marked as exportable
229
+
220
230
The :option:`--tlsCertificateKeyFile <--tlsCertificateKeyFile>` and
221
- :option:`--tlsCertificateSelector <--tlsCertificateSelector>` options
222
- are mutually exclusive. You can only specify one.
231
+ :option:`--tlsCertificateSelector <--tlsCertificateSelector>`
232
+ options are mutually exclusive. You can only specify one.
223
233
224
234
Specifies a certificate property in order to select a matching
225
235
certificate from the operating system's certificate store.
226
236
227
- :option:`--tlsCertificateSelector <--tlsCertificateSelector>` accepts
228
- an argument of the format ``<property>=<value>`` where the property
229
- can be one of the following:
237
+ :option:`--tlsCertificateSelector <--tlsCertificateSelector>`
238
+ accepts an argument of the format ``<property>=<value>`` where the
239
+ property can be one of the following:
230
240
231
241
.. list-table::
232
242
:header-rows: 1
233
243
234
244
* - Property
235
245
- Value type
236
246
- Description
237
-
247
+
238
248
* - ``subject``
239
249
- ASCII string
240
250
- Subject name or common name on certificate
@@ -257,25 +267,25 @@ TLS Options
257
267
.. include:: /includes/fact-certificate-expiry-warning.rst
258
268
259
269
.. option:: --tlsDisabledProtocols <string>
260
-
270
+
261
271
Disables the specified TLS protocols. The option recognizes the
262
272
following protocols:
263
-
273
+
264
274
- ``TLS1_0``
265
275
- ``TLS1_1``
266
276
- ``TLS1_2``
267
277
- *(Starting in version 4.0.4, 3.6.9, 3.4.24)* ``TLS1_3``
268
-
278
+
269
279
- On macOS, you cannot disable ``TLS1_1`` and leave both ``TLS1_0``
270
280
and ``TLS1_2`` enabled. You must also disable at least one of the
271
281
other two; for example, ``TLS1_0,TLS1_1``.
272
-
282
+
273
283
- To list multiple protocols, specify as a comma separated list of
274
284
protocols. For example ``TLS1_0,TLS1_1``.
275
-
285
+
276
286
- The specified disabled protocols overrides any default disabled
277
287
protocols.
278
-
288
+
279
289
Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS
280
290
1.1+ is available on the system. To enable the
281
291
disabled TLS 1.0, specify ``none`` to
@@ -285,11 +295,11 @@ Authentication Options
285
295
----------------------
286
296
287
297
.. option:: --authenticationDatabase <dbname>
288
-
298
+
289
299
Specifies the authentication database where the specified
290
300
:option:`--username <--username>` has been created. See
291
301
:ref:`user-authentication-database`.
292
-
302
+
293
303
294
304
If you do not specify a value for
295
305
:option:`--authenticationDatabase <--authenticationDatabase>`,
@@ -302,17 +312,17 @@ Authentication Options
302
312
303
313
Specifies the authentication mechanism the |mdb-shell| uses to
304
314
authenticate to the :binary:`~bin.mongod` or :binary:`~bin.mongos`.
305
-
315
+
306
316
.. note::
307
-
317
+
308
318
Starting in version 4.0:
309
-
319
+
310
320
- MongoDB removes support for the deprecated MongoDB
311
321
Challenge-Response (``MONGODB-CR``) authentication mechanism.
312
-
322
+
313
323
- MongoDB adds support for SCRAM mechanism using the SHA-256 hash
314
324
function (``SCRAM-SHA-256``).
315
-
325
+
316
326
.. list-table::
317
327
:header-rows: 1
318
328
:widths: 20 40
@@ -358,14 +368,14 @@ Authentication Options
358
368
Specify the hostname of a service using
359
369
:manual:`GSSAPI/Kerberos </core/kerberos>`. Only required if the
360
370
hostname of a machine does not match the hostname resolved by DNS.
361
-
371
+
362
372
This option is available only in MongoDB Enterprise.
363
373
364
374
.. option:: --gssapiServiceName
365
375
366
376
Specify the name of the service using
367
377
:manual:`GSSAPI/Kerberos </core/kerberos>`. Only required if the service does not use the default name of ``mongodb``.
368
-
378
+
369
379
This option is available only in MongoDB Enterprise.
370
380
371
381
.. option:: --password <password>, -p <password>
@@ -391,10 +401,10 @@ Session Options
391
401
---------------
392
402
393
403
.. option:: --retryWrites
394
-
404
+
395
405
Enables :manual:`retryable writes </core/retryable-writes/>` as the
396
406
default for sessions in the |mdb-shell|.
397
-
407
+
398
408
For more information on sessions, see :ref:`sessions`.
399
409
400
410
.. disableImplicitSessions
0 commit comments