mongodb 4.2.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/README.md +1 -1
  2. package/lib/admin.js +3 -3
  3. package/lib/admin.js.map +1 -1
  4. package/lib/bson.js +16 -14
  5. package/lib/bson.js.map +1 -1
  6. package/lib/bulk/common.js +3 -3
  7. package/lib/bulk/common.js.map +1 -1
  8. package/lib/bulk/ordered.js +1 -1
  9. package/lib/bulk/ordered.js.map +1 -1
  10. package/lib/bulk/unordered.js +1 -1
  11. package/lib/bulk/unordered.js.map +1 -1
  12. package/lib/change_stream.js +6 -6
  13. package/lib/change_stream.js.map +1 -1
  14. package/lib/cmap/auth/auth_provider.js.map +1 -1
  15. package/lib/cmap/auth/gssapi.js +3 -3
  16. package/lib/cmap/auth/gssapi.js.map +1 -1
  17. package/lib/cmap/auth/mongo_credentials.js +16 -18
  18. package/lib/cmap/auth/mongo_credentials.js.map +1 -1
  19. package/lib/cmap/auth/mongocr.js +2 -2
  20. package/lib/cmap/auth/mongocr.js.map +1 -1
  21. package/lib/cmap/auth/mongodb_aws.js +6 -6
  22. package/lib/cmap/auth/mongodb_aws.js.map +1 -1
  23. package/lib/cmap/auth/plain.js +1 -1
  24. package/lib/cmap/auth/plain.js.map +1 -1
  25. package/lib/cmap/auth/providers.js +21 -0
  26. package/lib/cmap/auth/providers.js.map +1 -0
  27. package/lib/cmap/auth/scram.js +4 -4
  28. package/lib/cmap/auth/scram.js.map +1 -1
  29. package/lib/cmap/auth/x509.js +1 -1
  30. package/lib/cmap/auth/x509.js.map +1 -1
  31. package/lib/cmap/command_monitoring_events.js +1 -1
  32. package/lib/cmap/command_monitoring_events.js.map +1 -1
  33. package/lib/cmap/commands.js +14 -8
  34. package/lib/cmap/commands.js.map +1 -1
  35. package/lib/cmap/connect.js +102 -15
  36. package/lib/cmap/connect.js.map +1 -1
  37. package/lib/cmap/connection.js +27 -26
  38. package/lib/cmap/connection.js.map +1 -1
  39. package/lib/cmap/connection_pool.js +19 -30
  40. package/lib/cmap/connection_pool.js.map +1 -1
  41. package/lib/cmap/message_stream.js +3 -3
  42. package/lib/cmap/message_stream.js.map +1 -1
  43. package/lib/cmap/stream_description.js +1 -1
  44. package/lib/cmap/stream_description.js.map +1 -1
  45. package/lib/cmap/wire_protocol/compression.js.map +1 -1
  46. package/lib/cmap/wire_protocol/shared.js +4 -3
  47. package/lib/cmap/wire_protocol/shared.js.map +1 -1
  48. package/lib/collection.js +45 -47
  49. package/lib/collection.js.map +1 -1
  50. package/lib/connection_string.js +48 -19
  51. package/lib/connection_string.js.map +1 -1
  52. package/lib/constants.js +108 -1
  53. package/lib/constants.js.map +1 -1
  54. package/lib/cursor/abstract_cursor.js +5 -5
  55. package/lib/cursor/abstract_cursor.js.map +1 -1
  56. package/lib/cursor/aggregation_cursor.js +1 -1
  57. package/lib/cursor/aggregation_cursor.js.map +1 -1
  58. package/lib/cursor/find_cursor.js +1 -1
  59. package/lib/cursor/find_cursor.js.map +1 -1
  60. package/lib/db.js +23 -13
  61. package/lib/db.js.map +1 -1
  62. package/lib/deps.js +0 -1
  63. package/lib/deps.js.map +1 -1
  64. package/lib/encrypter.js +12 -4
  65. package/lib/encrypter.js.map +1 -1
  66. package/lib/gridfs/download.js +1 -1
  67. package/lib/gridfs/download.js.map +1 -1
  68. package/lib/gridfs/index.js +3 -3
  69. package/lib/gridfs/index.js.map +1 -1
  70. package/lib/gridfs/upload.js +3 -2
  71. package/lib/gridfs/upload.js.map +1 -1
  72. package/lib/index.js +81 -81
  73. package/lib/index.js.map +1 -1
  74. package/lib/logger.js +1 -1
  75. package/lib/logger.js.map +1 -1
  76. package/lib/mongo_client.js +5 -5
  77. package/lib/mongo_client.js.map +1 -1
  78. package/lib/mongo_types.js.map +1 -1
  79. package/lib/operations/add_user.js +2 -2
  80. package/lib/operations/add_user.js.map +1 -1
  81. package/lib/operations/aggregate.js +1 -1
  82. package/lib/operations/aggregate.js.map +1 -1
  83. package/lib/operations/bulk_write.js.map +1 -1
  84. package/lib/operations/collections.js +1 -1
  85. package/lib/operations/collections.js.map +1 -1
  86. package/lib/operations/command.js +5 -6
  87. package/lib/operations/command.js.map +1 -1
  88. package/lib/operations/common_functions.js.map +1 -1
  89. package/lib/operations/connect.js +4 -13
  90. package/lib/operations/connect.js.map +1 -1
  91. package/lib/operations/count.js +1 -1
  92. package/lib/operations/count.js.map +1 -1
  93. package/lib/operations/count_documents.js.map +1 -1
  94. package/lib/operations/create_collection.js +3 -2
  95. package/lib/operations/create_collection.js.map +1 -1
  96. package/lib/operations/delete.js +3 -3
  97. package/lib/operations/delete.js.map +1 -1
  98. package/lib/operations/distinct.js +3 -3
  99. package/lib/operations/distinct.js.map +1 -1
  100. package/lib/operations/drop.js +1 -1
  101. package/lib/operations/drop.js.map +1 -1
  102. package/lib/operations/estimated_document_count.js +2 -2
  103. package/lib/operations/estimated_document_count.js.map +1 -1
  104. package/lib/operations/eval.js +2 -2
  105. package/lib/operations/eval.js.map +1 -1
  106. package/lib/operations/execute_operation.js +5 -6
  107. package/lib/operations/execute_operation.js.map +1 -1
  108. package/lib/operations/find.js +5 -5
  109. package/lib/operations/find.js.map +1 -1
  110. package/lib/operations/find_and_modify.js +2 -2
  111. package/lib/operations/find_and_modify.js.map +1 -1
  112. package/lib/operations/get_more.js.map +1 -1
  113. package/lib/operations/indexes.js +4 -4
  114. package/lib/operations/indexes.js.map +1 -1
  115. package/lib/operations/insert.js +3 -3
  116. package/lib/operations/insert.js.map +1 -1
  117. package/lib/operations/is_capped.js +1 -1
  118. package/lib/operations/is_capped.js.map +1 -1
  119. package/lib/operations/list_collections.js +3 -3
  120. package/lib/operations/list_collections.js.map +1 -1
  121. package/lib/operations/list_databases.js +1 -1
  122. package/lib/operations/list_databases.js.map +1 -1
  123. package/lib/operations/map_reduce.js +4 -3
  124. package/lib/operations/map_reduce.js.map +1 -1
  125. package/lib/operations/operation.js +1 -1
  126. package/lib/operations/operation.js.map +1 -1
  127. package/lib/operations/options_operation.js +1 -1
  128. package/lib/operations/options_operation.js.map +1 -1
  129. package/lib/operations/profiling_level.js +1 -1
  130. package/lib/operations/profiling_level.js.map +1 -1
  131. package/lib/operations/remove_user.js +1 -1
  132. package/lib/operations/remove_user.js.map +1 -1
  133. package/lib/operations/rename.js +3 -3
  134. package/lib/operations/rename.js.map +1 -1
  135. package/lib/operations/run_command.js +1 -1
  136. package/lib/operations/run_command.js.map +1 -1
  137. package/lib/operations/set_profiling_level.js +2 -2
  138. package/lib/operations/set_profiling_level.js.map +1 -1
  139. package/lib/operations/stats.js +1 -1
  140. package/lib/operations/stats.js.map +1 -1
  141. package/lib/operations/update.js +2 -2
  142. package/lib/operations/update.js.map +1 -1
  143. package/lib/operations/validate_collection.js +1 -1
  144. package/lib/operations/validate_collection.js.map +1 -1
  145. package/lib/read_preference.js +11 -4
  146. package/lib/read_preference.js.map +1 -1
  147. package/lib/sdam/monitor.js +4 -4
  148. package/lib/sdam/monitor.js.map +1 -1
  149. package/lib/sdam/server.js +24 -31
  150. package/lib/sdam/server.js.map +1 -1
  151. package/lib/sdam/server_description.js +1 -1
  152. package/lib/sdam/server_description.js.map +1 -1
  153. package/lib/sdam/server_selection.js +2 -2
  154. package/lib/sdam/server_selection.js.map +1 -1
  155. package/lib/sdam/srv_polling.js +2 -2
  156. package/lib/sdam/srv_polling.js.map +1 -1
  157. package/lib/sdam/topology.js +25 -55
  158. package/lib/sdam/topology.js.map +1 -1
  159. package/lib/sdam/topology_description.js +2 -2
  160. package/lib/sdam/topology_description.js.map +1 -1
  161. package/lib/sessions.js +12 -27
  162. package/lib/sessions.js.map +1 -1
  163. package/lib/transactions.js +1 -1
  164. package/lib/transactions.js.map +1 -1
  165. package/lib/utils.js +40 -9
  166. package/lib/utils.js.map +1 -1
  167. package/mongodb.d.ts +105 -32
  168. package/mongodb.ts34.d.ts +129 -32
  169. package/package.json +7 -3
  170. package/src/admin.ts +9 -9
  171. package/src/bson.ts +25 -17
  172. package/src/bulk/common.ts +17 -17
  173. package/src/bulk/ordered.ts +4 -4
  174. package/src/bulk/unordered.ts +5 -5
  175. package/src/change_stream.ts +25 -24
  176. package/src/cmap/auth/auth_provider.ts +3 -3
  177. package/src/cmap/auth/gssapi.ts +8 -8
  178. package/src/cmap/auth/mongo_credentials.ts +2 -6
  179. package/src/cmap/auth/mongocr.ts +3 -2
  180. package/src/cmap/auth/mongodb_aws.ts +10 -11
  181. package/src/cmap/auth/plain.ts +1 -1
  182. package/src/cmap/auth/providers.ts +21 -0
  183. package/src/cmap/auth/scram.ts +9 -9
  184. package/src/cmap/auth/x509.ts +3 -3
  185. package/src/cmap/command_monitoring_events.ts +2 -2
  186. package/src/cmap/commands.ts +22 -14
  187. package/src/cmap/connect.ts +142 -22
  188. package/src/cmap/connection.ts +72 -52
  189. package/src/cmap/connection_pool.ts +39 -39
  190. package/src/cmap/connection_pool_events.ts +1 -1
  191. package/src/cmap/message_stream.ts +9 -8
  192. package/src/cmap/stream_description.ts +2 -2
  193. package/src/cmap/wire_protocol/compression.ts +2 -2
  194. package/src/cmap/wire_protocol/shared.ts +10 -9
  195. package/src/collection.ts +94 -82
  196. package/src/connection_string.ts +66 -24
  197. package/src/constants.ts +116 -0
  198. package/src/cursor/abstract_cursor.ts +14 -13
  199. package/src/cursor/aggregation_cursor.ts +6 -6
  200. package/src/cursor/find_cursor.ts +2 -2
  201. package/src/db.ts +44 -33
  202. package/src/deps.ts +3 -1
  203. package/src/encrypter.ts +12 -3
  204. package/src/error.ts +1 -1
  205. package/src/gridfs/download.ts +10 -8
  206. package/src/gridfs/index.ts +11 -11
  207. package/src/gridfs/upload.ts +13 -10
  208. package/src/index.ts +204 -199
  209. package/src/logger.ts +2 -1
  210. package/src/mongo_client.ts +46 -32
  211. package/src/mongo_types.ts +97 -19
  212. package/src/operations/add_user.ts +6 -5
  213. package/src/operations/aggregate.ts +5 -5
  214. package/src/operations/bulk_write.ts +5 -5
  215. package/src/operations/collections.ts +2 -2
  216. package/src/operations/command.ts +15 -9
  217. package/src/operations/common_functions.ts +4 -4
  218. package/src/operations/connect.ts +4 -14
  219. package/src/operations/count.ts +4 -4
  220. package/src/operations/count_documents.ts +3 -3
  221. package/src/operations/create_collection.ts +7 -6
  222. package/src/operations/delete.ts +5 -5
  223. package/src/operations/distinct.ts +4 -4
  224. package/src/operations/drop.ts +4 -4
  225. package/src/operations/estimated_document_count.ts +5 -5
  226. package/src/operations/eval.ts +5 -5
  227. package/src/operations/execute_operation.ts +10 -11
  228. package/src/operations/find.ts +14 -14
  229. package/src/operations/find_and_modify.ts +7 -7
  230. package/src/operations/get_more.ts +2 -2
  231. package/src/operations/indexes.ts +16 -16
  232. package/src/operations/insert.ts +9 -9
  233. package/src/operations/is_capped.ts +3 -3
  234. package/src/operations/list_collections.ts +6 -6
  235. package/src/operations/list_databases.ts +4 -4
  236. package/src/operations/map_reduce.ts +10 -9
  237. package/src/operations/operation.ts +3 -3
  238. package/src/operations/options_operation.ts +3 -3
  239. package/src/operations/profiling_level.ts +4 -4
  240. package/src/operations/remove_user.ts +4 -4
  241. package/src/operations/rename.ts +6 -6
  242. package/src/operations/run_command.ts +3 -3
  243. package/src/operations/set_profiling_level.ts +6 -5
  244. package/src/operations/stats.ts +4 -4
  245. package/src/operations/update.ts +10 -10
  246. package/src/operations/validate_collection.ts +4 -4
  247. package/src/read_preference.ts +14 -6
  248. package/src/sdam/common.ts +2 -2
  249. package/src/sdam/events.ts +1 -1
  250. package/src/sdam/monitor.ts +13 -14
  251. package/src/sdam/server.ts +63 -61
  252. package/src/sdam/server_description.ts +4 -4
  253. package/src/sdam/server_selection.ts +3 -3
  254. package/src/sdam/srv_polling.ts +3 -2
  255. package/src/sdam/topology.ts +63 -81
  256. package/src/sdam/topology_description.ts +4 -4
  257. package/src/sessions.ts +30 -48
  258. package/src/transactions.ts +4 -4
  259. package/src/utils.ts +58 -22
  260. package/lib/cmap/auth/defaultAuthProviders.js +0 -30
  261. package/lib/cmap/auth/defaultAuthProviders.js.map +0 -1
  262. package/src/cmap/auth/defaultAuthProviders.ts +0 -32
package/src/index.ts CHANGED
@@ -1,122 +1,121 @@
1
+ import { Admin } from './admin';
2
+ import { ObjectId } from './bson';
3
+ import { Collection } from './collection';
1
4
  import { AbstractCursor } from './cursor/abstract_cursor';
2
5
  import { AggregationCursor } from './cursor/aggregation_cursor';
3
6
  import { FindCursor } from './cursor/find_cursor';
4
- import { ListIndexesCursor } from './operations/indexes';
5
- import { ListCollectionsCursor } from './operations/list_collections';
6
- import { PromiseProvider } from './promise_provider';
7
- import { Admin } from './admin';
8
- import { MongoClient } from './mongo_client';
9
7
  import { Db } from './db';
10
- import { Collection } from './collection';
11
- import { Logger } from './logger';
12
8
  import { GridFSBucket } from './gridfs';
9
+ import { Logger } from './logger';
10
+ import { MongoClient } from './mongo_client';
13
11
  import { CancellationToken } from './mongo_types';
12
+ import { ListIndexesCursor } from './operations/indexes';
13
+ import { ListCollectionsCursor } from './operations/list_collections';
14
+ import { PromiseProvider } from './promise_provider';
14
15
 
15
16
  export {
16
17
  Binary,
18
+ BSONRegExp,
19
+ BSONSymbol,
17
20
  Code,
18
21
  DBRef,
22
+ Decimal128,
19
23
  Double,
20
24
  Int32,
21
25
  Long,
22
- MinKey,
26
+ Map,
23
27
  MaxKey,
28
+ MinKey,
24
29
  ObjectId,
25
- Timestamp,
26
- Decimal128,
27
- BSONRegExp,
28
- BSONSymbol,
29
- Map
30
+ Timestamp
30
31
  } from './bson';
31
-
32
- import { ObjectId } from 'bson';
33
32
  /**
34
33
  * @public
35
34
  * @deprecated Please use `ObjectId`
36
35
  */
37
36
  export const ObjectID = ObjectId;
38
37
 
38
+ export { AnyBulkWriteOperation, BulkWriteOptions, MongoBulkWriteError } from './bulk/common';
39
39
  export {
40
- MongoError,
41
- MongoServerError,
42
- MongoDriverError,
43
40
  MongoAPIError,
41
+ MongoBatchReExecutionError,
42
+ MongoChangeStreamError,
44
43
  MongoCompatibilityError,
44
+ MongoCursorExhaustedError,
45
+ MongoCursorInUseError,
46
+ MongoDecompressionError,
47
+ MongoDriverError,
48
+ MongoError,
49
+ MongoExpiredSessionError,
50
+ MongoGridFSChunkError,
51
+ MongoGridFSStreamError,
45
52
  MongoInvalidArgumentError,
53
+ MongoKerberosError,
46
54
  MongoMissingCredentialsError,
47
55
  MongoMissingDependencyError,
48
56
  MongoNetworkError,
49
57
  MongoNetworkTimeoutError,
50
- MongoSystemError,
51
- MongoServerSelectionError,
58
+ MongoNotConnectedError,
52
59
  MongoParseError,
53
- MongoWriteConcernError,
54
60
  MongoRuntimeError,
55
- MongoChangeStreamError,
56
- MongoGridFSStreamError,
57
- MongoGridFSChunkError,
58
- MongoDecompressionError,
59
- MongoBatchReExecutionError,
60
- MongoCursorExhaustedError,
61
- MongoCursorInUseError,
62
- MongoNotConnectedError,
63
- MongoExpiredSessionError,
64
- MongoTransactionError,
65
- MongoKerberosError,
66
61
  MongoServerClosedError,
67
- MongoTopologyClosedError
62
+ MongoServerError,
63
+ MongoServerSelectionError,
64
+ MongoSystemError,
65
+ MongoTopologyClosedError,
66
+ MongoTransactionError,
67
+ MongoWriteConcernError
68
68
  } from './error';
69
- export { MongoBulkWriteError, BulkWriteOptions, AnyBulkWriteOperation } from './bulk/common';
70
69
  export {
71
- // Utils
72
- PromiseProvider as Promise,
70
+ AbstractCursor,
73
71
  // Actual driver classes exported
74
72
  Admin,
75
- MongoClient,
76
- Db,
77
- Collection,
78
- Logger,
79
- AbstractCursor,
80
73
  AggregationCursor,
74
+ CancellationToken,
75
+ Collection,
76
+ Db,
81
77
  FindCursor,
82
- ListIndexesCursor,
83
- ListCollectionsCursor,
84
78
  GridFSBucket,
85
- CancellationToken
79
+ ListCollectionsCursor,
80
+ ListIndexesCursor,
81
+ Logger,
82
+ MongoClient,
83
+ // Utils
84
+ PromiseProvider as Promise
86
85
  };
87
86
 
88
87
  // enums
89
- export { ProfilingLevel } from './operations/set_profiling_level';
90
- export { ServerType, TopologyType } from './sdam/common';
91
- export { LoggerLevel } from './logger';
92
- export { AutoEncryptionLoggerLevel } from './deps';
93
88
  export { BatchType } from './bulk/common';
94
- export { AuthMechanism } from './cmap/auth/defaultAuthProviders';
95
- export { CURSOR_FLAGS } from './cursor/abstract_cursor';
89
+ export { AuthMechanism } from './cmap/auth/providers';
96
90
  export { Compressor } from './cmap/wire_protocol/compression';
97
- export { ReturnDocument } from './operations/find_and_modify';
91
+ export { CURSOR_FLAGS } from './cursor/abstract_cursor';
92
+ export { AutoEncryptionLoggerLevel } from './deps';
98
93
  export { ExplainVerbosity } from './explain';
99
- export { ReadConcernLevel } from './read_concern';
100
- export { ReadPreferenceMode } from './read_preference';
94
+ export { LoggerLevel } from './logger';
101
95
  export { ServerApiVersion } from './mongo_client';
102
96
  export { BSONType } from './mongo_types';
97
+ export { ReturnDocument } from './operations/find_and_modify';
98
+ export { ProfilingLevel } from './operations/set_profiling_level';
99
+ export { ReadConcernLevel } from './read_concern';
100
+ export { ReadPreferenceMode } from './read_preference';
101
+ export { ServerType, TopologyType } from './sdam/common';
103
102
 
104
103
  // Helper classes
105
- export { WriteConcern } from './write_concern';
106
104
  export { ReadConcern } from './read_concern';
107
105
  export { ReadPreference } from './read_preference';
106
+ export { WriteConcern } from './write_concern';
108
107
 
109
108
  // events
110
109
  export {
110
+ CommandFailedEvent,
111
111
  CommandStartedEvent,
112
- CommandSucceededEvent,
113
- CommandFailedEvent
112
+ CommandSucceededEvent
114
113
  } from './cmap/command_monitoring_events';
115
114
  export {
116
- ConnectionCheckOutFailedEvent,
117
- ConnectionCheckOutStartedEvent,
118
115
  ConnectionCheckedInEvent,
119
116
  ConnectionCheckedOutEvent,
117
+ ConnectionCheckOutFailedEvent,
118
+ ConnectionCheckOutStartedEvent,
120
119
  ConnectionClosedEvent,
121
120
  ConnectionCreatedEvent,
122
121
  ConnectionPoolClearedEvent,
@@ -126,11 +125,11 @@ export {
126
125
  ConnectionReadyEvent
127
126
  } from './cmap/connection_pool_events';
128
127
  export {
129
- ServerHeartbeatStartedEvent,
130
- ServerHeartbeatSucceededEvent,
131
- ServerHeartbeatFailedEvent,
132
128
  ServerClosedEvent,
133
129
  ServerDescriptionChangedEvent,
130
+ ServerHeartbeatFailedEvent,
131
+ ServerHeartbeatStartedEvent,
132
+ ServerHeartbeatSucceededEvent,
134
133
  ServerOpeningEvent,
135
134
  TopologyClosedEvent,
136
135
  TopologyDescriptionChangedEvent,
@@ -140,84 +139,98 @@ export { SrvPollingEvent } from './sdam/srv_polling';
140
139
 
141
140
  // type only exports below, these are removed from emitted JS
142
141
  export type { AdminPrivate } from './admin';
143
- export type { Document, BSONSerializeOptions } from './bson';
142
+ export type { BSONSerializeOptions, Document } from './bson';
143
+ export type { deserialize, serialize } from './bson';
144
144
  export type {
145
+ BulkResult,
146
+ BulkWriteOperationError,
147
+ BulkWriteResult,
148
+ DeleteManyModel,
149
+ DeleteOneModel,
145
150
  InsertOneModel,
146
151
  ReplaceOneModel,
147
- UpdateOneModel,
148
152
  UpdateManyModel,
149
- DeleteOneModel,
150
- DeleteManyModel,
151
- BulkResult,
152
- BulkWriteResult,
153
- WriteError,
153
+ UpdateOneModel,
154
154
  WriteConcernError,
155
- BulkWriteOperationError
155
+ WriteError
156
156
  } from './bulk/common';
157
+ export type {
158
+ Batch,
159
+ BulkOperationBase,
160
+ BulkOperationPrivate,
161
+ FindOperators,
162
+ WriteConcernErrorData
163
+ } from './bulk/common';
164
+ export type { OrderedBulkOperation } from './bulk/ordered';
165
+ export type { UnorderedBulkOperation } from './bulk/unordered';
157
166
  export type {
158
167
  ChangeStream,
168
+ ChangeStreamCursor,
169
+ ChangeStreamCursorOptions,
159
170
  ChangeStreamDocument,
160
- UpdateDescription,
161
171
  ChangeStreamEvents,
162
172
  ChangeStreamOptions,
163
- ChangeStreamCursor,
164
- ResumeToken,
165
- PipeOptions,
166
- ChangeStreamCursorOptions,
167
173
  OperationTime,
168
- ResumeOptions
174
+ PipeOptions,
175
+ ResumeOptions,
176
+ ResumeToken,
177
+ UpdateDescription
169
178
  } from './change_stream';
170
179
  export type {
171
- MongoCredentials,
172
180
  AuthMechanismProperties,
181
+ MongoCredentials,
173
182
  MongoCredentialsOptions
174
183
  } from './cmap/auth/mongo_credentials';
175
184
  export type {
176
- WriteProtocolMessageType,
177
- Query,
178
185
  GetMore,
179
- Msg,
180
186
  KillCursor,
187
+ Msg,
181
188
  OpGetMoreOptions,
182
- OpQueryOptions
189
+ OpQueryOptions,
190
+ Query,
191
+ WriteProtocolMessageType
183
192
  } from './cmap/commands';
184
- export type { Stream, LEGAL_TLS_SOCKET_OPTIONS, LEGAL_TCP_SOCKET_OPTIONS } from './cmap/connect';
193
+ export type { LEGAL_TCP_SOCKET_OPTIONS, LEGAL_TLS_SOCKET_OPTIONS, Stream } from './cmap/connect';
185
194
  export type {
195
+ CommandOptions,
186
196
  Connection,
197
+ ConnectionEvents,
187
198
  ConnectionOptions,
188
199
  DestroyOptions,
189
- CommandOptions,
190
- QueryOptions,
191
200
  GetMoreOptions,
192
- ConnectionEvents
201
+ ProxyOptions,
202
+ QueryOptions
193
203
  } from './cmap/connection';
194
- export type { ConnectionPoolMetrics } from './cmap/metrics';
195
204
  export type {
196
205
  CloseOptions,
206
+ ConnectionPool,
207
+ ConnectionPoolEvents,
197
208
  ConnectionPoolOptions,
198
209
  WaitQueueMember,
199
- WithConnectionCallback,
200
- ConnectionPool,
201
- ConnectionPoolEvents
210
+ WithConnectionCallback
202
211
  } from './cmap/connection_pool';
203
212
  export type {
204
- OperationDescription,
205
213
  MessageStream,
206
- MessageStreamOptions
214
+ MessageStreamOptions,
215
+ OperationDescription
207
216
  } from './cmap/message_stream';
217
+ export type { ConnectionPoolMetrics } from './cmap/metrics';
208
218
  export type { StreamDescription, StreamDescriptionOptions } from './cmap/stream_description';
209
219
  export type { CompressorName } from './cmap/wire_protocol/compression';
210
- export type { CollectionPrivate, CollectionOptions, ModifyResult } from './collection';
211
- export type { AggregationCursorOptions } from './cursor/aggregation_cursor';
220
+ export type { CollectionOptions, CollectionPrivate, ModifyResult } from './collection';
221
+ export type { MONGO_CLIENT_EVENTS } from './constants';
212
222
  export type {
213
- CursorCloseOptions,
214
- CursorStreamOptions,
215
- AbstractCursorOptions,
216
223
  AbstractCursorEvents,
217
- CursorFlag
224
+ AbstractCursorOptions,
225
+ CursorCloseOptions,
226
+ CursorFlag,
227
+ CursorStreamOptions
218
228
  } from './cursor/abstract_cursor';
219
- export type { DbPrivate, DbOptions } from './db';
220
- export type { AutoEncryptionOptions, AutoEncrypter } from './deps';
229
+ export type { InternalAbstractCursorOptions } from './cursor/abstract_cursor';
230
+ export type { AggregationCursorOptions } from './cursor/aggregation_cursor';
231
+ export type { DbOptions, DbPrivate } from './db';
232
+ export type { AutoEncrypter, AutoEncryptionOptions } from './deps';
233
+ export type { Encrypter, EncrypterOptions } from './encrypter';
221
234
  export type { AnyError, ErrorDescription, MongoNetworkErrorOptions } from './error';
222
235
  export type { Explain, ExplainOptions, ExplainVerbosityLike } from './explain';
223
236
  export type {
@@ -227,46 +240,87 @@ export type {
227
240
  GridFSBucketReadStreamPrivate,
228
241
  GridFSFile
229
242
  } from './gridfs/download';
230
- export type { GridFSBucketOptions, GridFSBucketPrivate, GridFSBucketEvents } from './gridfs/index';
243
+ export type { GridFSBucketEvents, GridFSBucketOptions, GridFSBucketPrivate } from './gridfs/index';
231
244
  export type {
232
- GridFSBucketWriteStreamOptions,
233
245
  GridFSBucketWriteStream,
246
+ GridFSBucketWriteStreamOptions,
234
247
  GridFSChunk
235
248
  } from './gridfs/upload';
236
- export type { LoggerOptions, LoggerFunction } from './logger';
249
+ export type { LoggerFunction, LoggerOptions } from './logger';
237
250
  export type {
238
- MongoClientEvents,
239
- MongoClientPrivate,
240
- MongoClientOptions,
241
- WithSessionCallback,
242
- PkFactory,
243
251
  Auth,
244
252
  DriverInfo,
253
+ MongoClientEvents,
254
+ MongoClientOptions,
255
+ MongoClientPrivate,
245
256
  MongoOptions,
257
+ PkFactory,
246
258
  ServerApi,
247
259
  SupportedNodeConnectionOptions,
260
+ SupportedSocketOptions,
248
261
  SupportedTLSConnectionOptions,
249
262
  SupportedTLSSocketOptions,
250
- SupportedSocketOptions
263
+ WithSessionCallback
251
264
  } from './mongo_client';
252
265
  export type {
253
- TypedEventEmitter,
254
- EventsDescription,
255
266
  CommonEvents,
256
- GenericListener
267
+ EventsDescription,
268
+ GenericListener,
269
+ TypedEventEmitter
270
+ } from './mongo_types';
271
+ export type {
272
+ AcceptedFields,
273
+ AddToSetOperators,
274
+ AlternativeType,
275
+ ArrayOperator,
276
+ BitwiseFilter,
277
+ BSONTypeAlias,
278
+ Condition,
279
+ EnhancedOmit,
280
+ Filter,
281
+ FilterOperations,
282
+ FilterOperators,
283
+ Flatten,
284
+ InferIdType,
285
+ IntegerType,
286
+ IsAny,
287
+ Join,
288
+ KeysOfAType,
289
+ KeysOfOtherType,
290
+ MatchKeysAndValues,
291
+ NestedPaths,
292
+ NonObjectIdLikeDocument,
293
+ NotAcceptedFields,
294
+ NumericType,
295
+ OneOrMore,
296
+ OnlyFieldsOfType,
297
+ OptionalId,
298
+ OptionalUnlessRequiredId,
299
+ Projection,
300
+ ProjectionOperators,
301
+ PropertyType,
302
+ PullAllOperator,
303
+ PullOperator,
304
+ PushOperator,
305
+ RegExpOrString,
306
+ RootFilterOperators,
307
+ SchemaMember,
308
+ SetFields,
309
+ UpdateFilter,
310
+ WithId,
311
+ WithoutId
257
312
  } from './mongo_types';
258
313
  export type { AddUserOptions, RoleSpecification } from './operations/add_user';
259
314
  export type {
260
- AggregateOptions,
261
315
  AggregateOperation,
316
+ AggregateOptions,
262
317
  DB_AGGREGATE_COLLECTION
263
318
  } from './operations/aggregate';
264
- export type { MONGO_CLIENT_EVENTS } from './operations/connect';
265
319
  export type {
266
- CommandOperationOptions,
267
- OperationParent,
320
+ CollationOptions,
268
321
  CommandOperation,
269
- CollationOptions
322
+ CommandOperationOptions,
323
+ OperationParent
270
324
  } from './operations/command';
271
325
  export type { IndexInformationOptions } from './operations/common_functions';
272
326
  export type { CountOptions } from './operations/count';
@@ -280,85 +334,85 @@ export type { DistinctOptions } from './operations/distinct';
280
334
  export type { DropCollectionOptions, DropDatabaseOptions } from './operations/drop';
281
335
  export type { EstimatedDocumentCountOptions } from './operations/estimated_document_count';
282
336
  export type { EvalOptions } from './operations/eval';
337
+ export type { ExecutionResult } from './operations/execute_operation';
283
338
  export type { FindOptions } from './operations/find';
284
- export type { Sort, SortDirection, SortDirectionForCmd, SortForCmd } from './sort';
285
339
  export type {
286
340
  FindOneAndDeleteOptions,
287
341
  FindOneAndReplaceOptions,
288
342
  FindOneAndUpdateOptions
289
343
  } from './operations/find_and_modify';
290
344
  export type {
291
- IndexSpecification,
292
345
  CreateIndexesOptions,
293
- IndexDescription,
294
346
  DropIndexesOptions,
295
- ListIndexesOptions,
296
- IndexDirection
347
+ IndexDescription,
348
+ IndexDirection,
349
+ IndexSpecification,
350
+ ListIndexesOptions
297
351
  } from './operations/indexes';
298
- export type { InsertOneResult, InsertOneOptions, InsertManyResult } from './operations/insert';
299
- export type { ListCollectionsOptions, CollectionInfo } from './operations/list_collections';
300
- export type { ListDatabasesResult, ListDatabasesOptions } from './operations/list_databases';
352
+ export type { InsertManyResult, InsertOneOptions, InsertOneResult } from './operations/insert';
353
+ export type { CollectionInfo, ListCollectionsOptions } from './operations/list_collections';
354
+ export type { ListDatabasesOptions, ListDatabasesResult } from './operations/list_databases';
301
355
  export type {
356
+ FinalizeFunction,
302
357
  MapFunction,
303
- ReduceFunction,
304
358
  MapReduceOptions,
305
- FinalizeFunction
359
+ ReduceFunction
306
360
  } from './operations/map_reduce';
307
- export type { Hint, OperationOptions, AbstractOperation } from './operations/operation';
361
+ export type { AbstractOperation, Hint, OperationOptions } from './operations/operation';
308
362
  export type { ProfilingLevelOptions } from './operations/profiling_level';
309
363
  export type { RemoveUserOptions } from './operations/remove_user';
310
364
  export type { RenameOptions } from './operations/rename';
311
365
  export type { RunCommandOptions } from './operations/run_command';
312
366
  export type { SetProfilingLevelOptions } from './operations/set_profiling_level';
313
367
  export type {
368
+ CollStats,
314
369
  CollStatsOptions,
315
370
  DbStatsOptions,
316
- CollStats,
317
371
  WiredTigerData
318
372
  } from './operations/stats';
319
373
  export type {
320
- UpdateResult,
321
- UpdateOptions,
322
374
  ReplaceOptions,
375
+ UpdateOptions,
376
+ UpdateResult,
323
377
  UpdateStatement
324
378
  } from './operations/update';
325
379
  export type { ValidateCollectionOptions } from './operations/validate_collection';
326
380
  export type { ReadConcernLike } from './read_concern';
327
381
  export type {
382
+ HedgeOptions,
383
+ ReadPreferenceFromOptions,
328
384
  ReadPreferenceLike,
329
- ReadPreferenceOptions,
330
385
  ReadPreferenceLikeOptions,
331
- ReadPreferenceFromOptions,
332
- HedgeOptions
386
+ ReadPreferenceOptions
333
387
  } from './read_preference';
334
388
  export type { ClusterTime, TimerQueue } from './sdam/common';
335
389
  export type {
336
390
  Monitor,
337
391
  MonitorEvents,
338
- MonitorPrivate,
339
392
  MonitorOptions,
393
+ MonitorPrivate,
340
394
  RTTPinger,
341
395
  RTTPingerOptions
342
396
  } from './sdam/monitor';
343
- export type { Server, ServerEvents, ServerPrivate, ServerOptions } from './sdam/server';
397
+ export type { Server, ServerEvents, ServerOptions, ServerPrivate } from './sdam/server';
344
398
  export type {
345
- TopologyVersion,
346
- TagSet,
347
399
  ServerDescription,
348
- ServerDescriptionOptions
400
+ ServerDescriptionOptions,
401
+ TagSet,
402
+ TopologyVersion
349
403
  } from './sdam/server_description';
350
404
  export type { ServerSelector } from './sdam/server_selection';
351
405
  export type { SrvPoller, SrvPollerEvents, SrvPollerOptions } from './sdam/srv_polling';
352
406
  export type {
407
+ ConnectOptions,
408
+ SelectServerOptions,
409
+ ServerCapabilities,
410
+ ServerSelectionCallback,
411
+ ServerSelectionRequest,
353
412
  Topology,
354
413
  TopologyEvents,
355
- TopologyPrivate,
356
- ServerSelectionRequest,
357
414
  TopologyOptions,
358
- ServerCapabilities,
359
- ConnectOptions,
360
- SelectServerOptions,
361
- ServerSelectionCallback
415
+ TopologyPrivate
362
416
  } from './sdam/topology';
363
417
  export type { TopologyDescription, TopologyDescriptionOptions } from './sdam/topology_description';
364
418
  export type {
@@ -366,70 +420,21 @@ export type {
366
420
  ClientSessionEvents,
367
421
  ClientSessionOptions,
368
422
  EndSessionOptions,
369
- ServerSessionPool,
370
423
  ServerSession,
371
424
  ServerSessionId,
425
+ ServerSessionPool,
372
426
  WithTransactionCallback
373
427
  } from './sessions';
374
- export type { TransactionOptions, Transaction, TxnState } from './transactions';
428
+ export type { Sort, SortDirection, SortDirectionForCmd, SortForCmd } from './sort';
429
+ export type { Transaction, TransactionOptions, TxnState } from './transactions';
375
430
  export type {
431
+ BufferPool,
376
432
  Callback,
377
433
  ClientMetadata,
378
434
  ClientMetadataOptions,
379
- MongoDBNamespace,
380
- InterruptibleAsyncInterval,
381
- BufferPool,
435
+ EventEmitterWithState,
382
436
  HostAddress,
383
- EventEmitterWithState
437
+ InterruptibleAsyncInterval,
438
+ MongoDBNamespace
384
439
  } from './utils';
385
440
  export type { W, WriteConcernOptions, WriteConcernSettings } from './write_concern';
386
- export type { ExecutionResult } from './operations/execute_operation';
387
- export type { InternalAbstractCursorOptions } from './cursor/abstract_cursor';
388
- export type {
389
- BulkOperationBase,
390
- BulkOperationPrivate,
391
- FindOperators,
392
- Batch,
393
- WriteConcernErrorData
394
- } from './bulk/common';
395
- export type { OrderedBulkOperation } from './bulk/ordered';
396
- export type { UnorderedBulkOperation } from './bulk/unordered';
397
- export type { Encrypter, EncrypterOptions } from './encrypter';
398
- export type {
399
- EnhancedOmit,
400
- WithId,
401
- OptionalId,
402
- WithoutId,
403
- UpdateFilter,
404
- Filter,
405
- Projection,
406
- InferIdType,
407
- ProjectionOperators,
408
- Flatten,
409
- SchemaMember,
410
- Condition,
411
- RootFilterOperators,
412
- AlternativeType,
413
- FilterOperators,
414
- BSONTypeAlias,
415
- BitwiseFilter,
416
- RegExpOrString,
417
- OnlyFieldsOfType,
418
- NumericType,
419
- IntegerType,
420
- MatchKeysAndValues,
421
- SetFields,
422
- PullOperator,
423
- PushOperator,
424
- PullAllOperator,
425
- AcceptedFields,
426
- NotAcceptedFields,
427
- AddToSetOperators,
428
- ArrayOperator,
429
- FilterOperations,
430
- KeysOfAType,
431
- KeysOfOtherType,
432
- IsAny,
433
- OneOrMore
434
- } from './mongo_types';
435
- export type { serialize, deserialize } from './bson';
package/src/logger.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { format } from 'util';
2
- import { enumToString } from './utils';
2
+
3
3
  import { MongoInvalidArgumentError } from './error';
4
+ import { enumToString } from './utils';
4
5
 
5
6
  // Filters for classes
6
7
  const classFilters: any = {};