Skip to content

Commit 7199d26

Browse files
authored
docs(NODE-4778): update tls option notes (#3671)
1 parent adef3f7 commit 7199d26

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/mongo_client.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -772,19 +772,29 @@ export interface MongoOptions
772772
/**
773773
* # NOTE ABOUT TLS Options
774774
*
775-
* If set TLS enabled, equivalent to setting the ssl option.
775+
* If `tls` is provided as an option, it is equivalent to setting the `ssl` option.
776+
*
777+
* NodeJS native TLS options are passed through to the socket and retain their original types.
776778
*
777779
* ### Additional options:
778780
*
779-
* | nodejs option | MongoDB equivalent | type |
780-
* |:---------------------|--------------------------------------------------------- |:---------------------------------------|
781-
* | `ca` | `sslCA`, `tlsCAFile` | `string \| Buffer \| Buffer[]` |
782-
* | `crl` | `sslCRL` | `string \| Buffer \| Buffer[]` |
783-
* | `cert` | `sslCert`, `tlsCertificateFile`, `tlsCertificateKeyFile` | `string \| Buffer \| Buffer[]` |
784-
* | `key` | `sslKey`, `tlsCertificateKeyFile` | `string \| Buffer \| KeyObject[]` |
785-
* | `passphrase` | `sslPass`, `tlsCertificateKeyFilePassword` | `string` |
786-
* | `rejectUnauthorized` | `sslValidate` | `boolean` |
781+
* | nodejs native option | driver spec compliant option name | legacy option name | driver option type |
782+
* |:----------------------|:----------------------------------------------|:-------------------|:-------------------|
783+
* | `ca` | `tlsCAFile` | `sslCA` | `string` |
784+
* | `crl` | N/A | `sslCRL` | `string` |
785+
* | `cert` | `tlsCertificateFile`, `tlsCertificateKeyFile` | `sslCert` | `string` |
786+
* | `key` | `tlsCertificateKeyFile` | `sslKey` | `string` |
787+
* | `passphrase` | `tlsCertificateKeyFilePassword` | `sslPass` | `string` |
788+
* | `rejectUnauthorized` | `tlsAllowInvalidCertificates` | `sslValidate` | `boolean` |
789+
* | `checkServerIdentity` | `tlsAllowInvalidHostnames` | N/A | `boolean` |
790+
* | see note below | `tlsInsecure` | N/A | `boolean` |
791+
*
792+
* If `tlsInsecure` is set to `true`, then it will set the node native options `checkServerIdentity`
793+
* to a no-op and `rejectUnauthorized` to `false`.
787794
*
795+
* If `tlsInsecure` is set to `false`, then it will set the node native options `checkServerIdentity`
796+
* to a no-op and `rejectUnauthorized` to the inverse value of `tlsAllowInvalidCertificates`. If
797+
* `tlsAllowInvalidCertificates` is not set, then `rejectUnauthorized` will be set to `true`.
788798
*/
789799
tls: boolean;
790800

0 commit comments

Comments
 (0)