1
1
import type { MongoCredentials } from './cmap/auth/mongo_credentials' ;
2
- import type { CompressorName } from './cmap/wire_protocol/compression' ;
3
- import type { AutoEncryptionOptions } from './deps' ;
4
- import type { Logger } from './logger' ;
5
- import type { DriverInfo , MongoClientOptions , PkFactory } from './mongo_client' ;
2
+ import type { MongoClientOptions } from './mongo_client' ;
6
3
import type { ReadConcern } from './read_concern' ;
7
4
import type { ReadPreference } from './read_preference' ;
8
5
import type { WriteConcern } from './write_concern' ;
@@ -20,79 +17,78 @@ import { URL } from 'url';
20
17
export interface MongoOptions
21
18
extends Required < BSONSerializeOptions > ,
22
19
Omit < ConnectionOptions , 'port' > ,
23
- Omit < TLSConnectionOptions , 'port' > {
20
+ Omit < TLSConnectionOptions , 'port' > ,
21
+ Required <
22
+ Pick <
23
+ MongoClientOptions ,
24
+ | 'autoEncryption'
25
+ | 'compression'
26
+ | 'compressors'
27
+ | 'connectTimeoutMS'
28
+ | 'dbName'
29
+ | 'directConnection'
30
+ | 'domainsEnabled'
31
+ | 'driverInfo'
32
+ | 'forceServerObjectId'
33
+ | 'gssapiServiceName'
34
+ | 'ha'
35
+ | 'haInterval'
36
+ | 'heartbeatFrequencyMS'
37
+ | 'keepAlive'
38
+ | 'keepAliveInitialDelay'
39
+ | 'localThresholdMS'
40
+ | 'logger'
41
+ | 'maxIdleTimeMS'
42
+ | 'maxPoolSize'
43
+ | 'minPoolSize'
44
+ | 'monitorCommands'
45
+ | 'noDelay'
46
+ | 'numberOfRetries'
47
+ | 'pkFactory'
48
+ | 'promiseLibrary'
49
+ | 'raw'
50
+ | 'reconnectInterval'
51
+ | 'reconnectTries'
52
+ | 'replicaSet'
53
+ | 'retryReads'
54
+ | 'retryWrites'
55
+ | 'serverSelectionTimeoutMS'
56
+ | 'serverSelectionTryOnce'
57
+ | 'socketTimeoutMS'
58
+ | 'tlsAllowInvalidCertificates'
59
+ | 'tlsAllowInvalidHostnames'
60
+ | 'tlsInsecure'
61
+ | 'waitQueueMultiple'
62
+ | 'waitQueueTimeoutMS'
63
+ | 'zlibCompressionLevel'
64
+ >
65
+ > {
24
66
hosts : { host : string ; port : number } [ ] ;
25
67
srv : boolean ;
26
-
27
- autoEncryption : AutoEncryptionOptions ;
28
68
credentials : MongoCredentials ;
29
- compression : CompressorName ;
30
- compressors : CompressorName [ ] ;
31
- connectTimeoutMS : number ;
32
- dbName : string ;
33
- directConnection : boolean ;
34
- domainsEnabled : boolean ;
35
- driverInfo : DriverInfo ;
36
- forceServerObjectId : boolean ;
37
- gssapiServiceName : string ;
38
- ha : boolean ;
39
- haInterval : number ;
40
- heartbeatFrequencyMS : number ;
41
- keepAlive : boolean ;
42
- keepAliveInitialDelay : number ;
43
- localThresholdMS : number ;
44
- logger : Logger ;
45
- maxIdleTimeMS : number ;
46
-
47
- // poolSize: number;
48
- maxPoolSize : number ;
49
-
50
- maxStalenessSeconds : number ;
51
-
52
- // minSize: number;
53
- minPoolSize : number ;
54
-
55
- monitorCommands : boolean ;
56
- noDelay : boolean ;
57
- numberOfRetries : number ;
58
- pkFactory : PkFactory ;
59
- promiseLibrary : PromiseConstructorLike ;
60
- raw : boolean ;
61
- readConcern : ReadConcern ;
62
69
readPreference : ReadPreference ;
63
- reconnectInterval : number ;
64
- reconnectTries : number ;
65
- replicaSet : string ;
66
- retryReads : boolean ;
67
- retryWrites : boolean ;
68
- serverSelectionTimeoutMS : number ;
69
- serverSelectionTryOnce : boolean ;
70
- socketTimeoutMS : number ;
70
+ readConcern : ReadConcern ;
71
+ writeConcern : WriteConcern ;
71
72
72
73
/**
74
+ * # NOTE ABOUT TLS Options
75
+ *
73
76
* If set TLS enabled, equivalent to setting the ssl option.
74
77
*
75
78
* ### Additional options:
76
79
*
77
- * | nodejs option | MongoDB equivalent | type |
78
- * |:---------------------|----------------------------------------------------|:---------------------------------------|
79
- * | `ca` | sslCA, tlsCAFile | `string \| Buffer \| Buffer[]` |
80
- * | `crl` | sslCRL | `string \| Buffer \| Buffer[]` |
81
- * | `cert` | sslCert, tlsCertificateFile, tlsCertificateKeyFile | `string \| Buffer \| Buffer[]` |
82
- * | `key` | sslKey, tlsCertificateKeyFile | `string \| Buffer \| KeyObject[]` |
83
- * | `passphrase` | sslPass, tlsCertificateKeyFilePassword | `string` |
84
- * | `rejectUnauthorized` | sslValidate | `boolean` |
80
+ * | nodejs option | MongoDB equivalent | type |
81
+ * |:---------------------|--------------------------------------------------------- |:---------------------------------------|
82
+ * | `ca` | ` sslCA`, ` tlsCAFile` | `string \| Buffer \| Buffer[]` |
83
+ * | `crl` | ` sslCRL` | `string \| Buffer \| Buffer[]` |
84
+ * | `cert` | ` sslCert`, ` tlsCertificateFile`, ` tlsCertificateKeyFile` | `string \| Buffer \| Buffer[]` |
85
+ * | `key` | ` sslKey`, ` tlsCertificateKeyFile` | `string \| Buffer \| KeyObject[]` |
86
+ * | `passphrase` | ` sslPass`, ` tlsCertificateKeyFilePassword` | `string` |
87
+ * | `rejectUnauthorized` | ` sslValidate` | `boolean` |
85
88
*
86
89
*/
87
90
tls : boolean ;
88
- tlsAllowInvalidCertificates : boolean ;
89
- tlsAllowInvalidHostnames : boolean ;
90
- tlsInsecure : boolean ;
91
91
92
- waitQueueMultiple : number ;
93
- waitQueueTimeoutMS : number ;
94
- writeConcern : WriteConcern ;
95
- zlibCompressionLevel : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined ;
96
92
/**
97
93
* Turn these options into a reusable options dictionary
98
94
*/
0 commit comments