mongodb 6.8.0-dev.20240905.sha.65e0e15c → 6.8.1

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 (246) hide show
  1. package/README.md +1 -14
  2. package/lib/bson.js +13 -4
  3. package/lib/bson.js.map +1 -1
  4. package/lib/bulk/common.js +21 -16
  5. package/lib/bulk/common.js.map +1 -1
  6. package/lib/bulk/ordered.js.map +1 -1
  7. package/lib/bulk/unordered.js.map +1 -1
  8. package/lib/change_stream.js +8 -10
  9. package/lib/change_stream.js.map +1 -1
  10. package/lib/client-side-encryption/auto_encrypter.js +3 -14
  11. package/lib/client-side-encryption/auto_encrypter.js.map +1 -1
  12. package/lib/client-side-encryption/client_encryption.js +7 -25
  13. package/lib/client-side-encryption/client_encryption.js.map +1 -1
  14. package/lib/client-side-encryption/crypto_callbacks.js +6 -6
  15. package/lib/client-side-encryption/crypto_callbacks.js.map +1 -1
  16. package/lib/client-side-encryption/mongocryptd_manager.js +5 -9
  17. package/lib/client-side-encryption/mongocryptd_manager.js.map +1 -1
  18. package/lib/client-side-encryption/providers/aws.js +2 -1
  19. package/lib/client-side-encryption/providers/aws.js.map +1 -1
  20. package/lib/client-side-encryption/providers/azure.js +5 -5
  21. package/lib/client-side-encryption/providers/azure.js.map +1 -1
  22. package/lib/client-side-encryption/providers/gcp.js +2 -1
  23. package/lib/client-side-encryption/providers/gcp.js.map +1 -1
  24. package/lib/client-side-encryption/providers/index.js +3 -2
  25. package/lib/client-side-encryption/providers/index.js.map +1 -1
  26. package/lib/client-side-encryption/state_machine.js +4 -9
  27. package/lib/client-side-encryption/state_machine.js.map +1 -1
  28. package/lib/cmap/auth/auth_provider.js.map +1 -1
  29. package/lib/cmap/auth/aws_temporary_credentials.js.map +1 -1
  30. package/lib/cmap/auth/gssapi.js +4 -4
  31. package/lib/cmap/auth/gssapi.js.map +1 -1
  32. package/lib/cmap/auth/mongo_credentials.js.map +1 -1
  33. package/lib/cmap/auth/mongocr.js.map +1 -1
  34. package/lib/cmap/auth/mongodb_aws.js.map +1 -1
  35. package/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map +1 -1
  36. package/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map +1 -1
  37. package/lib/cmap/auth/mongodb_oidc/callback_workflow.js +2 -0
  38. package/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map +1 -1
  39. package/lib/cmap/auth/mongodb_oidc/command_builders.js +3 -2
  40. package/lib/cmap/auth/mongodb_oidc/command_builders.js.map +1 -1
  41. package/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map +1 -1
  42. package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map +1 -1
  43. package/lib/cmap/auth/mongodb_oidc/machine_workflow.js +2 -0
  44. package/lib/cmap/auth/mongodb_oidc/machine_workflow.js.map +1 -1
  45. package/lib/cmap/auth/mongodb_oidc/token_cache.js.map +1 -1
  46. package/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map +1 -1
  47. package/lib/cmap/auth/mongodb_oidc.js.map +1 -1
  48. package/lib/cmap/auth/plain.js.map +1 -1
  49. package/lib/cmap/auth/scram.js.map +1 -1
  50. package/lib/cmap/auth/x509.js.map +1 -1
  51. package/lib/cmap/command_monitoring_events.js.map +1 -1
  52. package/lib/cmap/commands.js +5 -62
  53. package/lib/cmap/commands.js.map +1 -1
  54. package/lib/cmap/connect.js +7 -9
  55. package/lib/cmap/connect.js.map +1 -1
  56. package/lib/cmap/connection.js +5 -3
  57. package/lib/cmap/connection.js.map +1 -1
  58. package/lib/cmap/connection_pool.js +9 -11
  59. package/lib/cmap/connection_pool.js.map +1 -1
  60. package/lib/cmap/connection_pool_events.js +3 -7
  61. package/lib/cmap/connection_pool_events.js.map +1 -1
  62. package/lib/cmap/handshake/client_metadata.js +5 -5
  63. package/lib/cmap/handshake/client_metadata.js.map +1 -1
  64. package/lib/cmap/metrics.js +1 -1
  65. package/lib/cmap/metrics.js.map +1 -1
  66. package/lib/cmap/stream_description.js.map +1 -1
  67. package/lib/cmap/wire_protocol/compression.js +5 -5
  68. package/lib/cmap/wire_protocol/compression.js.map +1 -1
  69. package/lib/cmap/wire_protocol/constants.js +2 -2
  70. package/lib/cmap/wire_protocol/on_data.js +2 -1
  71. package/lib/cmap/wire_protocol/on_data.js.map +1 -1
  72. package/lib/cmap/wire_protocol/on_demand/document.js +3 -12
  73. package/lib/cmap/wire_protocol/on_demand/document.js.map +1 -1
  74. package/lib/cmap/wire_protocol/responses.js +15 -6
  75. package/lib/cmap/wire_protocol/responses.js.map +1 -1
  76. package/lib/cmap/wire_protocol/shared.js +3 -2
  77. package/lib/cmap/wire_protocol/shared.js.map +1 -1
  78. package/lib/collection.js.map +1 -1
  79. package/lib/connection_string.js +5 -10
  80. package/lib/connection_string.js.map +1 -1
  81. package/lib/constants.js +0 -1
  82. package/lib/constants.js.map +1 -1
  83. package/lib/cursor/abstract_cursor.js +16 -25
  84. package/lib/cursor/abstract_cursor.js.map +1 -1
  85. package/lib/cursor/aggregation_cursor.js +2 -2
  86. package/lib/cursor/aggregation_cursor.js.map +1 -1
  87. package/lib/cursor/change_stream_cursor.js.map +1 -1
  88. package/lib/cursor/find_cursor.js +4 -4
  89. package/lib/cursor/find_cursor.js.map +1 -1
  90. package/lib/db.js +1 -1
  91. package/lib/db.js.map +1 -1
  92. package/lib/deps.js +8 -16
  93. package/lib/deps.js.map +1 -1
  94. package/lib/encrypter.js.map +1 -1
  95. package/lib/error.js +14 -19
  96. package/lib/error.js.map +1 -1
  97. package/lib/explain.js.map +1 -1
  98. package/lib/gridfs/download.js +4 -1
  99. package/lib/gridfs/download.js.map +1 -1
  100. package/lib/gridfs/index.js +1 -1
  101. package/lib/gridfs/index.js.map +1 -1
  102. package/lib/gridfs/upload.js +4 -0
  103. package/lib/gridfs/upload.js.map +1 -1
  104. package/lib/index.js +2 -4
  105. package/lib/index.js.map +1 -1
  106. package/lib/mongo_client.js +1 -15
  107. package/lib/mongo_client.js.map +1 -1
  108. package/lib/mongo_client_auth_providers.js.map +1 -1
  109. package/lib/mongo_logger.js +8 -8
  110. package/lib/mongo_logger.js.map +1 -1
  111. package/lib/mongo_types.js +0 -1
  112. package/lib/mongo_types.js.map +1 -1
  113. package/lib/operations/aggregate.js +0 -1
  114. package/lib/operations/aggregate.js.map +1 -1
  115. package/lib/operations/bulk_write.js.map +1 -1
  116. package/lib/operations/collections.js.map +1 -1
  117. package/lib/operations/command.js +1 -1
  118. package/lib/operations/command.js.map +1 -1
  119. package/lib/operations/count.js.map +1 -1
  120. package/lib/operations/create_collection.js.map +1 -1
  121. package/lib/operations/delete.js +2 -2
  122. package/lib/operations/delete.js.map +1 -1
  123. package/lib/operations/distinct.js.map +1 -1
  124. package/lib/operations/drop.js.map +1 -1
  125. package/lib/operations/estimated_document_count.js.map +1 -1
  126. package/lib/operations/execute_operation.js +109 -111
  127. package/lib/operations/execute_operation.js.map +1 -1
  128. package/lib/operations/find.js.map +1 -1
  129. package/lib/operations/find_and_modify.js +8 -2
  130. package/lib/operations/find_and_modify.js.map +1 -1
  131. package/lib/operations/get_more.js.map +1 -1
  132. package/lib/operations/indexes.js.map +1 -1
  133. package/lib/operations/insert.js.map +1 -1
  134. package/lib/operations/is_capped.js.map +1 -1
  135. package/lib/operations/kill_cursors.js.map +1 -1
  136. package/lib/operations/list_collections.js.map +1 -1
  137. package/lib/operations/list_databases.js.map +1 -1
  138. package/lib/operations/operation.js +5 -5
  139. package/lib/operations/operation.js.map +1 -1
  140. package/lib/operations/options_operation.js.map +1 -1
  141. package/lib/operations/profiling_level.js.map +1 -1
  142. package/lib/operations/search_indexes/drop.js.map +1 -1
  143. package/lib/operations/set_profiling_level.js.map +1 -1
  144. package/lib/operations/stats.js.map +1 -1
  145. package/lib/operations/update.js +2 -2
  146. package/lib/operations/update.js.map +1 -1
  147. package/lib/operations/validate_collection.js.map +1 -1
  148. package/lib/read_concern.js.map +1 -1
  149. package/lib/read_preference.js +1 -1
  150. package/lib/read_preference.js.map +1 -1
  151. package/lib/sdam/common.js +3 -3
  152. package/lib/sdam/common.js.map +1 -1
  153. package/lib/sdam/monitor.js +5 -1
  154. package/lib/sdam/monitor.js.map +1 -1
  155. package/lib/sdam/server.js +2 -2
  156. package/lib/sdam/server.js.map +1 -1
  157. package/lib/sdam/server_description.js +3 -3
  158. package/lib/sdam/server_description.js.map +1 -1
  159. package/lib/sdam/server_selection.js +5 -5
  160. package/lib/sdam/server_selection.js.map +1 -1
  161. package/lib/sdam/srv_polling.js +3 -2
  162. package/lib/sdam/srv_polling.js.map +1 -1
  163. package/lib/sdam/topology.js +1 -1
  164. package/lib/sdam/topology.js.map +1 -1
  165. package/lib/sdam/topology_description.js.map +1 -1
  166. package/lib/sessions.js +218 -221
  167. package/lib/sessions.js.map +1 -1
  168. package/lib/sort.js +3 -2
  169. package/lib/sort.js.map +1 -1
  170. package/lib/timeout.js +1 -0
  171. package/lib/timeout.js.map +1 -1
  172. package/lib/transactions.js +2 -2
  173. package/lib/transactions.js.map +1 -1
  174. package/lib/utils.js +51 -49
  175. package/lib/utils.js.map +1 -1
  176. package/lib/write_concern.js +2 -2
  177. package/lib/write_concern.js.map +1 -1
  178. package/mongodb.d.ts +143 -146
  179. package/package.json +28 -27
  180. package/src/bson.ts +13 -1
  181. package/src/bulk/common.ts +18 -18
  182. package/src/change_stream.ts +15 -33
  183. package/src/client-side-encryption/auto_encrypter.ts +82 -18
  184. package/src/client-side-encryption/client_encryption.ts +54 -51
  185. package/src/client-side-encryption/mongocryptd_manager.ts +6 -10
  186. package/src/client-side-encryption/state_machine.ts +6 -28
  187. package/src/cmap/auth/gssapi.ts +1 -1
  188. package/src/cmap/auth/mongodb_aws.ts +2 -2
  189. package/src/cmap/auth/mongodb_oidc/callback_workflow.ts +2 -2
  190. package/src/cmap/auth/mongodb_oidc/machine_workflow.ts +2 -2
  191. package/src/cmap/commands.ts +5 -70
  192. package/src/cmap/connect.ts +1 -3
  193. package/src/cmap/connection.ts +4 -3
  194. package/src/cmap/connection_pool.ts +9 -17
  195. package/src/cmap/connection_pool_events.ts +2 -34
  196. package/src/cmap/handshake/client_metadata.ts +1 -1
  197. package/src/cmap/wire_protocol/constants.ts +2 -2
  198. package/src/cmap/wire_protocol/on_demand/document.ts +14 -18
  199. package/src/cmap/wire_protocol/responses.ts +23 -5
  200. package/src/cmap/wire_protocol/shared.ts +2 -1
  201. package/src/collection.ts +15 -16
  202. package/src/connection_string.ts +2 -8
  203. package/src/constants.ts +0 -1
  204. package/src/cursor/abstract_cursor.ts +28 -42
  205. package/src/cursor/aggregation_cursor.ts +5 -7
  206. package/src/cursor/find_cursor.ts +1 -1
  207. package/src/deps.ts +1 -8
  208. package/src/error.ts +14 -33
  209. package/src/gridfs/download.ts +4 -28
  210. package/src/gridfs/upload.ts +6 -1
  211. package/src/index.ts +6 -6
  212. package/src/mongo_client.ts +3 -25
  213. package/src/mongo_logger.ts +3 -5
  214. package/src/mongo_types.ts +68 -69
  215. package/src/operations/aggregate.ts +1 -2
  216. package/src/operations/bulk_write.ts +2 -2
  217. package/src/operations/command.ts +1 -1
  218. package/src/operations/execute_operation.ts +131 -137
  219. package/src/operations/find_and_modify.ts +7 -2
  220. package/src/operations/insert.ts +4 -3
  221. package/src/operations/operation.ts +10 -7
  222. package/src/operations/search_indexes/drop.ts +1 -4
  223. package/src/sdam/monitor.ts +5 -3
  224. package/src/sdam/server.ts +1 -1
  225. package/src/sdam/server_description.ts +6 -5
  226. package/src/sdam/srv_polling.ts +2 -1
  227. package/src/sessions.ts +277 -291
  228. package/src/sort.ts +1 -1
  229. package/src/timeout.ts +1 -0
  230. package/src/transactions.ts +2 -1
  231. package/src/utils.ts +4 -9
  232. package/src/write_concern.ts +2 -2
  233. package/tsconfig.json +1 -2
  234. package/lib/beta.d.ts +0 -7900
  235. package/lib/beta.js +0 -21
  236. package/lib/beta.js.map +0 -1
  237. package/lib/operations/client_bulk_write/command_builder.js +0 -198
  238. package/lib/operations/client_bulk_write/command_builder.js.map +0 -1
  239. package/lib/operations/client_bulk_write/common.js +0 -3
  240. package/lib/operations/client_bulk_write/common.js.map +0 -1
  241. package/lib/resource_management.js +0 -58
  242. package/lib/resource_management.js.map +0 -1
  243. package/src/beta.ts +0 -22
  244. package/src/operations/client_bulk_write/command_builder.ts +0 -283
  245. package/src/operations/client_bulk_write/common.ts +0 -146
  246. package/src/resource_management.ts +0 -74
@@ -1,146 +0,0 @@
1
- import { type Document } from '../../bson';
2
- import type { Filter, OptionalId, UpdateFilter, WithoutId } from '../../mongo_types';
3
- import type { CollationOptions, CommandOperationOptions } from '../../operations/command';
4
- import type { Hint } from '../../operations/operation';
5
-
6
- /** @public */
7
- export interface ClientBulkWriteOptions extends CommandOperationOptions {
8
- /**
9
- * If true, when an insert fails, don't execute the remaining writes.
10
- * If false, continue with remaining inserts when one fails.
11
- * @defaultValue `true` - inserts are ordered by default
12
- */
13
- ordered?: boolean;
14
- /**
15
- * Allow driver to bypass schema validation.
16
- * @defaultValue `false` - documents will be validated by default
17
- **/
18
- bypassDocumentValidation?: boolean;
19
- /** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */
20
- let?: Document;
21
- /**
22
- * Whether detailed results for each successful operation should be included in the returned
23
- * BulkWriteResult.
24
- */
25
- verboseResults?: boolean;
26
- }
27
-
28
- /** @public */
29
- export interface ClientWriteModel {
30
- /** The namespace for the write. */
31
- namespace: string;
32
- }
33
-
34
- /** @public */
35
- export interface ClientInsertOneModel extends ClientWriteModel {
36
- name: 'insertOne';
37
- /** The document to insert. */
38
- document: OptionalId<Document>;
39
- }
40
-
41
- /** @public */
42
- export interface ClientDeleteOneModel extends ClientWriteModel {
43
- name: 'deleteOne';
44
- /**
45
- * The filter used to determine if a document should be deleted.
46
- * For a deleteOne operation, the first match is removed.
47
- */
48
- filter: Filter<Document>;
49
- /** Specifies a collation. */
50
- collation?: CollationOptions;
51
- /** The index to use. If specified, then the query system will only consider plans using the hinted index. */
52
- hint?: Hint;
53
- }
54
-
55
- /** @public */
56
- export interface ClientDeleteManyModel extends ClientWriteModel {
57
- name: 'deleteMany';
58
- /**
59
- * The filter used to determine if a document should be deleted.
60
- * For a deleteMany operation, all matches are removed.
61
- */
62
- filter: Filter<Document>;
63
- /** Specifies a collation. */
64
- collation?: CollationOptions;
65
- /** The index to use. If specified, then the query system will only consider plans using the hinted index. */
66
- hint?: Hint;
67
- }
68
-
69
- /** @public */
70
- export interface ClientReplaceOneModel extends ClientWriteModel {
71
- name: 'replaceOne';
72
- /**
73
- * The filter used to determine if a document should be replaced.
74
- * For a replaceOne operation, the first match is replaced.
75
- */
76
- filter: Filter<Document>;
77
- /** The document with which to replace the matched document. */
78
- replacement: WithoutId<Document>;
79
- /** Specifies a collation. */
80
- collation?: CollationOptions;
81
- /** The index to use. If specified, then the query system will only consider plans using the hinted index. */
82
- hint?: Hint;
83
- /** When true, creates a new document if no document matches the query. */
84
- upsert?: boolean;
85
- }
86
-
87
- /** @public */
88
- export interface ClientUpdateOneModel extends ClientWriteModel {
89
- name: 'updateOne';
90
- /**
91
- * The filter used to determine if a document should be updated.
92
- * For an updateOne operation, the first match is updated.
93
- */
94
- filter: Filter<Document>;
95
- /**
96
- * The modifications to apply. The value can be either:
97
- * UpdateFilter<Document> - A document that contains update operator expressions,
98
- * Document[] - an aggregation pipeline.
99
- */
100
- update: UpdateFilter<Document> | Document[];
101
- /** A set of filters specifying to which array elements an update should apply. */
102
- arrayFilters?: Document[];
103
- /** Specifies a collation. */
104
- collation?: CollationOptions;
105
- /** The index to use. If specified, then the query system will only consider plans using the hinted index. */
106
- hint?: Hint;
107
- /** When true, creates a new document if no document matches the query. */
108
- upsert?: boolean;
109
- }
110
-
111
- /** @public */
112
- export interface ClientUpdateManyModel extends ClientWriteModel {
113
- name: 'updateMany';
114
- /**
115
- * The filter used to determine if a document should be updated.
116
- * For an updateMany operation, all matches are updated.
117
- */
118
- filter: Filter<Document>;
119
- /**
120
- * The modifications to apply. The value can be either:
121
- * UpdateFilter<Document> - A document that contains update operator expressions,
122
- * Document[] - an aggregation pipeline.
123
- */
124
- update: UpdateFilter<Document> | Document[];
125
- /** A set of filters specifying to which array elements an update should apply. */
126
- arrayFilters?: Document[];
127
- /** Specifies a collation. */
128
- collation?: CollationOptions;
129
- /** The index to use. If specified, then the query system will only consider plans using the hinted index. */
130
- hint?: Hint;
131
- /** When true, creates a new document if no document matches the query. */
132
- upsert?: boolean;
133
- }
134
-
135
- /**
136
- * Used to represent any of the client bulk write models that can be passed as an array
137
- * to MongoClient#bulkWrite.
138
- * @public
139
- */
140
- export type AnyClientBulkWriteModel =
141
- | ClientInsertOneModel
142
- | ClientReplaceOneModel
143
- | ClientUpdateOneModel
144
- | ClientUpdateManyModel
145
- | ClientDeleteOneModel
146
- | ClientDeleteManyModel;
@@ -1,74 +0,0 @@
1
- /**
2
- * @public
3
- */
4
- export interface AsyncDisposable {
5
- /**
6
- * @beta
7
- * @experimental
8
- */
9
- [Symbol.asyncDispose](): Promise<void>;
10
-
11
- /**
12
- * @internal
13
- *
14
- * A method that wraps disposal semantics for a given resource in the class.
15
- */
16
- asyncDispose(): Promise<void>;
17
- }
18
-
19
- /** @internal */
20
- export function configureResourceManagement(target: AsyncDisposable) {
21
- Symbol.asyncDispose &&
22
- Object.defineProperty(target, Symbol.asyncDispose, {
23
- value: async function asyncDispose(this: AsyncDisposable) {
24
- await this.asyncDispose();
25
- },
26
- enumerable: false,
27
- configurable: true,
28
- writable: true
29
- });
30
- }
31
-
32
- /**
33
- * @beta
34
- * @experimental
35
- *
36
- * Attaches `Symbol.asyncDispose` methods to the MongoClient, Cursors, sessions and change streams
37
- * if Symbol.asyncDispose is defined.
38
- *
39
- * It's usually not necessary to call this method - the driver attempts to attach these methods
40
- * itself when its loaded. However, sometimes the driver may be loaded before `Symbol.asyncDispose`
41
- * is defined, in which case it is necessary to call this method directly. This can happen if the
42
- * application is polyfilling `Symbol.asyncDispose`.
43
- *
44
- * Example:
45
- *
46
- * ```typescript
47
- * import { configureExplicitResourceManagement, MongoClient } from 'mongodb/lib/beta';
48
- *
49
- * Symbol.asyncDispose ??= Symbol('dispose');
50
- * load();
51
- *
52
- * await using client = new MongoClient(...);
53
- * ```
54
- */
55
- export function configureExplicitResourceManagement() {
56
- // We must import lazily here, because there's a circular dependency between the resource management
57
- // file and each resources' file. We could move `configureResourceManagement` to a separate
58
- // function, but keeping all resource-management related code together seemed preferable and I chose
59
- // lazy requiring of resources instead.
60
-
61
- // eslint-disable-next-line @typescript-eslint/no-require-imports
62
- const { MongoClient } = require('./mongo_client');
63
- // eslint-disable-next-line @typescript-eslint/no-require-imports
64
- const { ClientSession } = require('./sessions');
65
- // eslint-disable-next-line @typescript-eslint/no-require-imports
66
- const { AbstractCursor } = require('./cursor/abstract_cursor');
67
- // eslint-disable-next-line @typescript-eslint/no-require-imports
68
- const { ChangeStream } = require('./change_stream');
69
-
70
- configureResourceManagement(MongoClient.prototype);
71
- configureResourceManagement(ClientSession.prototype);
72
- configureResourceManagement(AbstractCursor.prototype);
73
- configureResourceManagement(ChangeStream.prototype);
74
- }