@@ -772,19 +772,29 @@ export interface MongoOptions
772
772
/**
773
773
* # NOTE ABOUT TLS Options
774
774
*
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.
776
778
*
777
779
* ### Additional options:
778
780
*
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`.
787
794
*
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`.
788
798
*/
789
799
tls : boolean ;
790
800
0 commit comments