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
package/mongodb.d.ts CHANGED
@@ -1,37 +1,15 @@
1
- import type { ObjectIdLike } from 'bson';
2
- import type { DeserializeOptions } from 'bson';
3
- import type { SerializeOptions } from 'bson';
4
- import { Binary } from 'bson';
5
- import { BSON } from 'bson';
6
- import { BSONRegExp } from 'bson';
7
- import { BSONSymbol } from 'bson';
8
- import { BSONType } from 'bson';
9
- import { Code } from 'bson';
10
- import { DBRef } from 'bson';
11
- import { Decimal128 } from 'bson';
12
- import { deserialize } from 'bson';
13
- import { Document } from 'bson';
14
- import { Double } from 'bson';
15
- import { Int32 } from 'bson';
16
- import { Long } from 'bson';
17
- import { MaxKey } from 'bson';
18
- import { MinKey } from 'bson';
19
- import { ObjectId } from 'bson';
20
- import { serialize } from 'bson';
21
- import { Timestamp } from 'bson';
22
- import { UUID } from 'bson';
1
+ /// <reference types="node" />
2
+
3
+ import type { DeserializeOptions,ObjectIdLike , SerializeOptions } from 'bson';
4
+ import { Binary , BSON , BSONRegExp , BSONSymbol , BSONType , Code , DBRef , Decimal128 , deserialize , Document , Double , Int32 , Long , MaxKey , MinKey , ObjectId , serialize , Timestamp , UUID } from 'bson';
23
5
  import type { SrvRecord } from 'dns';
24
6
  import { EventEmitter } from 'events';
25
- import type { Socket } from 'net';
26
- import type { TcpNetConnectOpts } from 'net';
27
- import { Readable } from 'stream';
28
- import { Writable } from 'stream';
29
- import type { ConnectionOptions as ConnectionOptions_2 } from 'tls';
30
- import type { TLSSocket } from 'tls';
31
- import type { TLSSocketOptions } from 'tls';
7
+ import type { Socket , TcpNetConnectOpts } from 'net';
8
+ import { Readable , Writable } from 'stream';
9
+ import type { ConnectionOptions as ConnectionOptions_2 , TLSSocket , TLSSocketOptions } from 'tls';
32
10
 
33
11
  /** @public */
34
- export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable_2 {
12
+ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> {
35
13
  /* Excluded from this release type: cursorId */
36
14
  /* Excluded from this release type: cursorSession */
37
15
  /* Excluded from this release type: selectedServer */
@@ -45,6 +23,7 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
45
23
  /* Excluded from this release type: cursorOptions */
46
24
  /** @event */
47
25
  static readonly CLOSE: "close";
26
+ /* Excluded from this release type: deserializationOptions */
48
27
  /* Excluded from this release type: __constructor */
49
28
  /**
50
29
  * The cursor has no id until it receives a response from the initial cursor creating command.
@@ -72,12 +51,10 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
72
51
  */
73
52
  get killed(): boolean;
74
53
  get loadBalanced(): boolean;
75
- /* Excluded from this release type: [Symbol.asyncDispose] */
76
- /* Excluded from this release type: asyncDispose */
77
54
  /** Returns current buffered documents length */
78
55
  bufferedCount(): number;
79
56
  /** Returns current buffered documents */
80
- readBufferedDocuments(number?: number): NonNullable<TSchema>[];
57
+ readBufferedDocuments(number?: number): TSchema[];
81
58
  [Symbol.asyncIterator](): AsyncGenerator<TSchema, void, void>;
82
59
  stream(options?: CursorStreamOptions): Readable & AsyncIterable<TSchema>;
83
60
  hasNext(): Promise<boolean>;
@@ -96,9 +73,6 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
96
73
  * @deprecated - Will be removed in a future release. Use for await...of instead.
97
74
  */
98
75
  forEach(iterator: (doc: TSchema) => boolean | void): Promise<void>;
99
- /**
100
- * Frees any client-side resources used by the cursor.
101
- */
102
76
  close(): Promise<void>;
103
77
  /**
104
78
  * Returns an array of documents. The caller is responsible for making sure that there
@@ -527,15 +501,6 @@ export declare type ArrayOperator<Type> = {
527
501
  $sort?: Sort;
528
502
  };
529
503
 
530
- /**
531
- * @public
532
- */
533
- declare interface AsyncDisposable_2 {
534
- /* Excluded from this release type: [Symbol.asyncDispose] */
535
- /* Excluded from this release type: asyncDispose */
536
- }
537
- export { AsyncDisposable_2 as AsyncDisposable }
538
-
539
504
  /** @public */
540
505
  export declare interface Auth {
541
506
  /** The username for auth */
@@ -624,7 +589,77 @@ export declare interface AutoEncryptionOptions {
624
589
  /** The namespace where keys are stored in the key vault */
625
590
  keyVaultNamespace?: string;
626
591
  /** Configuration options that are used by specific KMS providers during key generation, encryption, and decryption. */
627
- kmsProviders?: KMSProviders;
592
+ kmsProviders?: {
593
+ /** Configuration options for using 'aws' as your KMS provider */
594
+ aws?: {
595
+ /** The access key used for the AWS KMS provider */
596
+ accessKeyId: string;
597
+ /** The secret access key used for the AWS KMS provider */
598
+ secretAccessKey: string;
599
+ /**
600
+ * An optional AWS session token that will be used as the
601
+ * X-Amz-Security-Token header for AWS requests.
602
+ */
603
+ sessionToken?: string;
604
+ } | Record<string, never>;
605
+ /** Configuration options for using 'local' as your KMS provider */
606
+ local?: {
607
+ /**
608
+ * The master key used to encrypt/decrypt data keys.
609
+ * A 96-byte long Buffer or base64 encoded string.
610
+ */
611
+ key: Buffer | string;
612
+ };
613
+ /** Configuration options for using 'azure' as your KMS provider */
614
+ azure?: {
615
+ /** The tenant ID identifies the organization for the account */
616
+ tenantId: string;
617
+ /** The client ID to authenticate a registered application */
618
+ clientId: string;
619
+ /** The client secret to authenticate a registered application */
620
+ clientSecret: string;
621
+ /**
622
+ * If present, a host with optional port. E.g. "example.com" or "example.com:443".
623
+ * This is optional, and only needed if customer is using a non-commercial Azure instance
624
+ * (e.g. a government or China account, which use different URLs).
625
+ * Defaults to "login.microsoftonline.com"
626
+ */
627
+ identityPlatformEndpoint?: string | undefined;
628
+ } | {
629
+ /**
630
+ * If present, an access token to authenticate with Azure.
631
+ */
632
+ accessToken: string;
633
+ } | Record<string, never>;
634
+ /** Configuration options for using 'gcp' as your KMS provider */
635
+ gcp?: {
636
+ /** The service account email to authenticate */
637
+ email: string;
638
+ /** A PKCS#8 encrypted key. This can either be a base64 string or a binary representation */
639
+ privateKey: string | Buffer;
640
+ /**
641
+ * If present, a host with optional port. E.g. "example.com" or "example.com:443".
642
+ * Defaults to "oauth2.googleapis.com"
643
+ */
644
+ endpoint?: string | undefined;
645
+ } | {
646
+ /**
647
+ * If present, an access token to authenticate with GCP.
648
+ */
649
+ accessToken: string;
650
+ } | Record<string, never>;
651
+ /**
652
+ * Configuration options for using 'kmip' as your KMS provider
653
+ */
654
+ kmip?: {
655
+ /**
656
+ * The output endpoint string.
657
+ * The endpoint consists of a hostname and port separated by a colon.
658
+ * E.g. "example.com:123". A port is always present.
659
+ */
660
+ endpoint?: string;
661
+ };
662
+ };
628
663
  /**
629
664
  * A map of namespaces to a local JSON schema for encryption
630
665
  *
@@ -916,7 +951,6 @@ export declare abstract class BulkOperationBase {
916
951
  find(selector: Document): FindOperators;
917
952
  /** Specifies a raw operation to perform in the bulk write. */
918
953
  raw(op: AnyBulkWriteOperation): this;
919
- get length(): number;
920
954
  get bsonOptions(): BSONSerializeOptions;
921
955
  get writeConcern(): WriteConcern | undefined;
922
956
  get batches(): Batch[];
@@ -1024,9 +1058,7 @@ export declare class CancellationToken extends TypedEventEmitter<{
1024
1058
  * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
1025
1059
  * @public
1026
1060
  */
1027
- export declare class ChangeStream<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable_2 {
1028
- /* Excluded from this release type: [Symbol.asyncDispose] */
1029
- /* Excluded from this release type: asyncDispose */
1061
+ export declare class ChangeStream<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> {
1030
1062
  pipeline: Document[];
1031
1063
  /**
1032
1064
  * @remarks WriteConcern can still be present on the options because
@@ -1085,9 +1117,7 @@ export declare class ChangeStream<TSchema extends Document = Document, TChange e
1085
1117
  [Symbol.asyncIterator](): AsyncGenerator<TChange, void, void>;
1086
1118
  /** Is the cursor closed */
1087
1119
  get closed(): boolean;
1088
- /**
1089
- * Frees the internal resources used by the change stream.
1090
- */
1120
+ /** Close the Change Stream */
1091
1121
  close(): Promise<void>;
1092
1122
  /**
1093
1123
  * Return a modified Readable stream including a possible transform method.
@@ -1743,7 +1773,9 @@ export declare class ClientEncryption {
1743
1773
  /**
1744
1774
  * Encrypts a Match Expression or Aggregate Expression to query a range index.
1745
1775
  *
1746
- * Only supported when queryType is "range" and algorithm is "Range".
1776
+ * Only supported when queryType is "rangePreview" and algorithm is "RangePreview".
1777
+ *
1778
+ * @experimental The Range algorithm is experimental only. It is not intended for production use. It is subject to breaking changes.
1747
1779
  *
1748
1780
  * @param expression - a BSON document of one of the following forms:
1749
1781
  * 1. A Match Expression of this form:
@@ -1815,7 +1847,36 @@ export declare interface ClientEncryptionEncryptOptions {
1815
1847
  /**
1816
1848
  * The algorithm to use for encryption.
1817
1849
  */
1818
- algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'Range';
1850
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'RangePreview';
1851
+ /**
1852
+ * The id of the Binary dataKey to use for encryption
1853
+ */
1854
+ keyId?: Binary;
1855
+ /**
1856
+ * A unique string name corresponding to an already existing dataKey.
1857
+ */
1858
+ keyAltName?: string;
1859
+ /** The contention factor. */
1860
+ contentionFactor?: bigint | number;
1861
+ /**
1862
+ * The query type supported. Only the queryType `equality` is stable.
1863
+ *
1864
+ * @experimental Public Technical Preview: The queryType `rangePreview` is experimental.
1865
+ */
1866
+ queryType?: 'equality' | 'rangePreview';
1867
+ /** @experimental Public Technical Preview: The index options for a Queryable Encryption field supporting "rangePreview" queries.*/
1868
+ rangeOptions?: RangeOptions;
1869
+ }
1870
+
1871
+ /**
1872
+ * @public
1873
+ * Options to provide when encrypting data.
1874
+ */
1875
+ export declare interface ClientEncryptionEncryptOptions {
1876
+ /**
1877
+ * The algorithm to use for encryption.
1878
+ */
1879
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'RangePreview';
1819
1880
  /**
1820
1881
  * The id of the Binary dataKey to use for encryption
1821
1882
  */
@@ -1827,10 +1888,12 @@ export declare interface ClientEncryptionEncryptOptions {
1827
1888
  /** The contention factor. */
1828
1889
  contentionFactor?: bigint | number;
1829
1890
  /**
1830
- * The query type.
1891
+ * The query type supported. Only the queryType `equality` is stable.
1892
+ *
1893
+ * @experimental Public Technical Preview: The queryType `rangePreview` is experimental.
1831
1894
  */
1832
- queryType?: 'equality' | 'range';
1833
- /** The index options for a Queryable Encryption field supporting "range" queries.*/
1895
+ queryType?: 'equality' | 'rangePreview';
1896
+ /** @experimental Public Technical Preview: The index options for a Queryable Encryption field supporting "rangePreview" queries.*/
1834
1897
  rangeOptions?: RangeOptions;
1835
1898
  }
1836
1899
 
@@ -1879,13 +1942,6 @@ export declare interface ClientEncryptionRewrapManyDataKeyResult {
1879
1942
  bulkWriteResult?: BulkWriteResult;
1880
1943
  }
1881
1944
 
1882
- /**
1883
- * @public
1884
- *
1885
- * Socket options to use for KMS requests.
1886
- */
1887
- export declare type ClientEncryptionSocketOptions = Pick<MongoClientOptions, 'autoSelectFamily' | 'autoSelectFamilyAttemptTimeout'>;
1888
-
1889
1945
  /**
1890
1946
  * @public
1891
1947
  *
@@ -1945,7 +2001,7 @@ export declare interface ClientMetadataOptions {
1945
2001
  * NOTE: not meant to be instantiated directly.
1946
2002
  * @public
1947
2003
  */
1948
- export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable_2 {
2004
+ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
1949
2005
  /* Excluded from this release type: client */
1950
2006
  /* Excluded from this release type: sessionPool */
1951
2007
  hasEnded: boolean;
@@ -1977,16 +2033,11 @@ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents
1977
2033
  /* Excluded from this release type: unpin */
1978
2034
  get isPinned(): boolean;
1979
2035
  /**
1980
- * Frees any client-side resources held by the current session. If a session is in a transaction,
1981
- * the transaction is aborted.
1982
- *
1983
- * Does not end the session on the server.
2036
+ * Ends this session on the server
1984
2037
  *
1985
2038
  * @param options - Optional settings. Currently reserved for future use
1986
2039
  */
1987
2040
  endSession(options?: EndSessionOptions): Promise<void>;
1988
- /* Excluded from this release type: [Symbol.asyncDispose] */
1989
- /* Excluded from this release type: asyncDispose */
1990
2041
  /**
1991
2042
  * Advances the operationTime for a ClientSession.
1992
2043
  *
@@ -2221,7 +2272,7 @@ export declare class Collection<TSchema extends Document = Document> {
2221
2272
  * @param docs - The documents to insert
2222
2273
  * @param options - Optional settings for the command
2223
2274
  */
2224
- insertMany(docs: ReadonlyArray<OptionalUnlessRequiredId<TSchema>>, options?: BulkWriteOptions): Promise<InsertManyResult<TSchema>>;
2275
+ insertMany(docs: OptionalUnlessRequiredId<TSchema>[], options?: BulkWriteOptions): Promise<InsertManyResult<TSchema>>;
2225
2276
  /**
2226
2277
  * Perform a bulkWrite operation without a fluent API
2227
2278
  *
@@ -2241,7 +2292,7 @@ export declare class Collection<TSchema extends Document = Document> {
2241
2292
  * @param options - Optional settings for the command
2242
2293
  * @throws MongoDriverError if operations is not an array
2243
2294
  */
2244
- bulkWrite(operations: ReadonlyArray<AnyBulkWriteOperation<TSchema>>, options?: BulkWriteOptions): Promise<BulkWriteResult>;
2295
+ bulkWrite(operations: AnyBulkWriteOperation<TSchema>[], options?: BulkWriteOptions): Promise<BulkWriteResult>;
2245
2296
  /**
2246
2297
  * Update a single document in a collection
2247
2298
  *
@@ -2828,8 +2879,6 @@ export declare type CompressorName = keyof typeof Compressor;
2828
2879
  /** @public */
2829
2880
  export declare type Condition<T> = AlternativeType<T> | FilterOperators<AlternativeType<T>>;
2830
2881
 
2831
- /* Excluded from this release type: configureExplicitResourceManagement */
2832
-
2833
2882
  /* Excluded from this release type: Connection */
2834
2883
 
2835
2884
  /* Excluded from this release type: CONNECTION_CHECK_OUT_FAILED */
@@ -2875,14 +2924,6 @@ export declare class ConnectionCheckedOutEvent extends ConnectionPoolMonitoringE
2875
2924
  /** The id of the connection */
2876
2925
  connectionId: number | '<monitor>';
2877
2926
  /* Excluded from this release type: name */
2878
- /**
2879
- * The time it took to check out the connection.
2880
- * More specifically, the time elapsed between
2881
- * emitting a `ConnectionCheckOutStartedEvent`
2882
- * and emitting this event as part of the same checking out.
2883
- *
2884
- */
2885
- durationMS: number;
2886
2927
  /* Excluded from this release type: __constructor */
2887
2928
  }
2888
2929
 
@@ -2896,13 +2937,6 @@ export declare class ConnectionCheckOutFailedEvent extends ConnectionPoolMonitor
2896
2937
  reason: string;
2897
2938
  /* Excluded from this release type: error */
2898
2939
  /* Excluded from this release type: name */
2899
- /**
2900
- * The time it took to check out the connection.
2901
- * More specifically, the time elapsed between
2902
- * emitting a `ConnectionCheckOutStartedEvent`
2903
- * and emitting this event as part of the same check out.
2904
- */
2905
- durationMS: number;
2906
2940
  /* Excluded from this release type: __constructor */
2907
2941
  }
2908
2942
 
@@ -3078,18 +3112,6 @@ export declare class ConnectionPoolReadyEvent extends ConnectionPoolMonitoringEv
3078
3112
  export declare class ConnectionReadyEvent extends ConnectionPoolMonitoringEvent {
3079
3113
  /** The id of the connection */
3080
3114
  connectionId: number | '<monitor>';
3081
- /**
3082
- * The time it took to establish the connection.
3083
- * In accordance with the definition of establishment of a connection
3084
- * specified by `ConnectionPoolOptions.maxConnecting`,
3085
- * it is the time elapsed between emitting a `ConnectionCreatedEvent`
3086
- * and emitting this event as part of the same checking out.
3087
- *
3088
- * Naturally, when establishing a connection is part of checking out,
3089
- * this duration is not greater than
3090
- * `ConnectionCheckedOutEvent.duration`.
3091
- */
3092
- durationMS: number;
3093
3115
  /* Excluded from this release type: name */
3094
3116
  /* Excluded from this release type: __constructor */
3095
3117
  }
@@ -4641,7 +4663,7 @@ export declare interface KMSProviders {
4641
4663
  /* Excluded from this release type: kWaitQueue_2 */
4642
4664
 
4643
4665
  /** @public */
4644
- export declare const LEGAL_TCP_SOCKET_OPTIONS: readonly ["autoSelectFamily", "autoSelectFamilyAttemptTimeout", "family", "hints", "localAddress", "localPort", "lookup"];
4666
+ export declare const LEGAL_TCP_SOCKET_OPTIONS: readonly ["family", "hints", "localAddress", "localPort", "lookup"];
4645
4667
 
4646
4668
  /** @public */
4647
4669
  export declare const LEGAL_TLS_SOCKET_OPTIONS: readonly ["ALPNProtocols", "ca", "cert", "checkServerIdentity", "ciphers", "crl", "ecdhCurve", "key", "minDHSize", "passphrase", "pfx", "rejectUnauthorized", "secureContext", "secureProtocol", "servername", "session"];
@@ -4945,15 +4967,13 @@ export declare class MongoChangeStreamError extends MongoRuntimeError {
4945
4967
  * await client.insertOne({ name: 'spot', kind: 'dog' });
4946
4968
  * ```
4947
4969
  */
4948
- export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable_2 {
4970
+ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> {
4949
4971
  /* Excluded from this release type: s */
4950
4972
  /* Excluded from this release type: topology */
4951
4973
  /* Excluded from this release type: mongoLogger */
4952
4974
  /* Excluded from this release type: connectionLock */
4953
4975
  /* Excluded from this release type: [kOptions] */
4954
4976
  constructor(url: string, options?: MongoClientOptions);
4955
- /* Excluded from this release type: [Symbol.asyncDispose] */
4956
- /* Excluded from this release type: asyncDispose */
4957
4977
  /* Excluded from this release type: checkForNonGenuineHosts */
4958
4978
  /** @see MongoOptions */
4959
4979
  get options(): Readonly<MongoOptions>;
@@ -4973,15 +4993,7 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
4973
4993
  connect(): Promise<this>;
4974
4994
  /* Excluded from this release type: _connect */
4975
4995
  /**
4976
- * Cleans up client-side resources used by the MongoCLient and . This includes:
4977
- *
4978
- * - Closes all open, unused connections (see note).
4979
- * - Ends all in-use sessions with {@link ClientSession#endSession|ClientSession.endSession()}.
4980
- * - Ends all unused sessions server-side.
4981
- * - Cleans up any resources being used for auto encryption if auto encryption is enabled.
4982
- *
4983
- * @remarks Any in-progress operations are not killed and any connections used by in progress operations
4984
- * will be cleaned up lazily as operations finish.
4996
+ * Close the client and its underlying connections
4985
4997
  *
4986
4998
  * @param force - Force close, emitting no events
4987
4999
  */
@@ -6232,7 +6244,15 @@ export declare class MongoWriteConcernError extends MongoServerError {
6232
6244
  *
6233
6245
  * @public
6234
6246
  **/
6235
- constructor(result: WriteConcernErrorResult);
6247
+ constructor(result: {
6248
+ writeConcernError: {
6249
+ code: number;
6250
+ errmsg: string;
6251
+ codeName?: string;
6252
+ errInfo?: Document;
6253
+ };
6254
+ errorLabels?: string[];
6255
+ });
6236
6256
  get name(): string;
6237
6257
  }
6238
6258
 
@@ -6358,6 +6378,8 @@ export declare interface OIDCResponse {
6358
6378
 
6359
6379
  /* Excluded from this release type: OnDemandDocument */
6360
6380
 
6381
+ /* Excluded from this release type: OnDemandDocumentDeserializeOptions */
6382
+
6361
6383
  /** @public */
6362
6384
  export declare type OneOrMore<T> = T | ReadonlyArray<T>;
6363
6385
 
@@ -6482,19 +6504,14 @@ export declare type PushOperator<TSchema> = ({
6482
6504
 
6483
6505
  /**
6484
6506
  * @public
6485
- * RangeOptions specifies index options for a Queryable Encryption field supporting "range" queries.
6486
- * min, max, sparsity, trimFactor and range must match the values set in the encryptedFields of the destination collection.
6507
+ * RangeOptions specifies index options for a Queryable Encryption field supporting "rangePreview" queries.
6508
+ * min, max, sparsity, and range must match the values set in the encryptedFields of the destination collection.
6487
6509
  * For double and decimal128, min/max/precision must all be set, or all be unset.
6488
6510
  */
6489
6511
  export declare interface RangeOptions {
6490
- /** min is the minimum value for the encrypted index. Required if precision is set. */
6491
6512
  min?: any;
6492
- /** max is the minimum value for the encrypted index. Required if precision is set. */
6493
6513
  max?: any;
6494
- /** sparsity may be used to tune performance. must be non-negative. When omitted, a default value is used. */
6495
- sparsity?: Long | bigint;
6496
- /** trimFactor may be used to tune performance. must be non-negative. When omitted, a default value is used. */
6497
- trimFactor?: Int32 | number;
6514
+ sparsity: Long;
6498
6515
  precision?: number;
6499
6516
  }
6500
6517
 
@@ -7237,10 +7254,7 @@ export declare type StrictUpdateFilter<TSchema> = {
7237
7254
  export declare type SupportedNodeConnectionOptions = SupportedTLSConnectionOptions & SupportedTLSSocketOptions & SupportedSocketOptions;
7238
7255
 
7239
7256
  /** @public */
7240
- export declare type SupportedSocketOptions = Pick<TcpNetConnectOpts & {
7241
- autoSelectFamily?: boolean;
7242
- autoSelectFamilyAttemptTimeout?: number;
7243
- }, (typeof LEGAL_TCP_SOCKET_OPTIONS)[number]>;
7257
+ export declare type SupportedSocketOptions = Pick<TcpNetConnectOpts, (typeof LEGAL_TCP_SOCKET_OPTIONS)[number]>;
7244
7258
 
7245
7259
  /** @public */
7246
7260
  export declare type SupportedTLSConnectionOptions = Pick<ConnectionOptions_2, Extract<keyof ConnectionOptions_2, (typeof LEGAL_TLS_SOCKET_OPTIONS)[number]>>;
@@ -7773,23 +7787,6 @@ export declare interface WriteConcernErrorData {
7773
7787
  errInfo?: Document;
7774
7788
  }
7775
7789
 
7776
- /**
7777
- * The type of the result property of MongoWriteConcernError
7778
- * @public
7779
- */
7780
- export declare interface WriteConcernErrorResult {
7781
- writeConcernError: {
7782
- code: number;
7783
- errmsg: string;
7784
- codeName?: string;
7785
- errInfo?: Document;
7786
- };
7787
- ok: number;
7788
- code?: number;
7789
- errorLabels?: string[];
7790
- [x: string | number]: unknown;
7791
- }
7792
-
7793
7790
  /** @public */
7794
7791
  export declare interface WriteConcernOptions {
7795
7792
  /** Write Concern as an object */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "6.8.0-dev.20240905.sha.65e0e15c",
3
+ "version": "6.8.1",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -62,53 +62,55 @@
62
62
  }
63
63
  },
64
64
  "devDependencies": {
65
- "@aws-sdk/credential-providers": "^3.632.0",
65
+ "@aws-sdk/credential-providers": "^3.515.0",
66
66
  "@iarna/toml": "^2.2.5",
67
67
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
68
- "@microsoft/api-extractor": "^7.47.5",
69
- "@microsoft/tsdoc-config": "^0.17.0",
68
+ "@microsoft/api-extractor": "^7.43.1",
69
+ "@microsoft/tsdoc-config": "^0.16.2",
70
70
  "@mongodb-js/zstd": "^1.2.0",
71
- "@types/chai": "^4.3.17",
71
+ "@types/chai": "^4.3.14",
72
72
  "@types/chai-subset": "^1.3.5",
73
73
  "@types/express": "^4.17.21",
74
74
  "@types/kerberos": "^1.1.5",
75
- "@types/mocha": "^10.0.7",
76
- "@types/node": "^22.4.1",
75
+ "@types/mocha": "^10.0.6",
76
+ "@types/node": "^20.12.7",
77
77
  "@types/saslprep": "^1.0.3",
78
78
  "@types/semver": "^7.5.8",
79
79
  "@types/sinon": "^17.0.3",
80
80
  "@types/sinon-chai": "^3.2.12",
81
- "@types/whatwg-url": "^11.0.5",
82
- "@typescript-eslint/eslint-plugin": "^8.2.0",
83
- "@typescript-eslint/parser": "^8.2.0",
81
+ "@types/whatwg-url": "^11.0.4",
82
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
83
+ "@typescript-eslint/parser": "^5.62.0",
84
84
  "chai": "^4.4.1",
85
85
  "chai-subset": "^1.6.0",
86
86
  "chalk": "^4.1.2",
87
- "eslint": "^9.0.0",
88
- "eslint-config-prettier": "^9.1.0",
87
+ "eslint": "^8.56.0",
88
+ "eslint-config-prettier": "^8.10.0",
89
+ "eslint-plugin-github": "^4.10.2",
90
+ "eslint-plugin-import": "^2.29.1",
89
91
  "eslint-plugin-mocha": "^10.4.1",
90
- "eslint-plugin-prettier": "^5.2.1",
91
- "eslint-plugin-simple-import-sort": "^12.1.1",
92
- "eslint-plugin-tsdoc": "^0.3.0",
93
- "eslint-plugin-unused-imports": "^4.0.0",
92
+ "eslint-plugin-prettier": "^4.2.1",
93
+ "eslint-plugin-simple-import-sort": "^10.0.0",
94
+ "eslint-plugin-tsdoc": "^0.2.17",
95
+ "eslint-plugin-unused-imports": "^2.0.0",
94
96
  "express": "^4.19.2",
95
97
  "gcp-metadata": "^5.3.0",
96
98
  "js-yaml": "^4.1.0",
97
99
  "mocha": "^10.4.0",
98
100
  "mocha-sinon": "^2.1.2",
99
- "mongodb-client-encryption": "^6.1.0",
100
- "mongodb-legacy": "^6.1.0",
101
+ "mongodb-client-encryption": "^6.0.1",
102
+ "mongodb-legacy": "^6.0.1",
101
103
  "nyc": "^15.1.0",
102
- "prettier": "^3.3.3",
103
- "semver": "^7.6.3",
104
- "sinon": "^18.0.0",
104
+ "prettier": "^2.8.8",
105
+ "semver": "^7.6.0",
106
+ "sinon": "^17.0.1",
105
107
  "sinon-chai": "^3.7.0",
106
108
  "snappy": "^7.2.2",
107
109
  "socks": "^2.8.1",
108
110
  "source-map-support": "^0.5.21",
109
111
  "ts-node": "^10.9.2",
110
- "tsd": "^0.31.1",
111
- "typescript": "5.5",
112
+ "tsd": "^0.31.0",
113
+ "typescript": "5.0",
112
114
  "typescript-cached-transpile": "^0.0.6",
113
115
  "v8-heapsnapshot": "^1.3.1",
114
116
  "yargs": "^17.7.2"
@@ -124,7 +126,7 @@
124
126
  "scripts": {
125
127
  "build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
126
128
  "build:ts": "node ./node_modules/typescript/bin/tsc",
127
- "build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts lib/beta.d.ts",
129
+ "build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && eslint mongodb.d.ts --fix",
128
130
  "build:docs": "./etc/docs/build.ts",
129
131
  "build:typedoc": "typedoc",
130
132
  "build:nightly": "node ./.github/scripts/nightly.mjs",
@@ -134,7 +136,7 @@
134
136
  "check:lambda": "mocha --config test/mocha_lambda.json test/integration/node-specific/examples/handler.test.js",
135
137
  "check:lambda:aws": "mocha --config test/mocha_lambda.json test/integration/node-specific/examples/aws_handler.test.js",
136
138
  "check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd",
137
- "check:eslint": "npm run build:dts && ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ext '.js,.ts' src test",
139
+ "check:eslint": "eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
138
140
  "check:tsd": "tsd --version && tsd",
139
141
  "check:dependencies": "mocha test/action/dependency.test.ts",
140
142
  "check:dts": "node ./node_modules/typescript/bin/tsc --noEmit mongodb.d.ts && tsd",
@@ -143,7 +145,6 @@
143
145
  "check:unit": "mocha test/unit",
144
146
  "check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
145
147
  "check:atlas": "mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.ts",
146
- "check:resource-management": "mocha --config test/manual/mocharc.json test/manual/resource_management.test.ts",
147
148
  "check:drivers-atlas-testing": "mocha --config test/mocha_mongodb.json test/atlas/drivers_atlas_testing.test.ts",
148
149
  "check:adl": "mocha --config test/mocha_mongodb.json test/manual/atlas-data-lake-testing",
149
150
  "check:aws": "nyc mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_aws.test.ts",
@@ -175,4 +176,4 @@
175
176
  "moduleResolution": "node"
176
177
  }
177
178
  }
178
- }
179
+ }
package/src/bson.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { BSON, type DeserializeOptions, type SerializeOptions } from 'bson';
1
+ import type { DeserializeOptions, SerializeOptions } from 'bson';
2
+ import { BSON } from 'bson';
2
3
 
3
4
  export {
4
5
  Binary,
@@ -132,3 +133,14 @@ export function resolveBSONOptions(
132
133
  options?.enableUtf8Validation ?? parentOptions?.enableUtf8Validation ?? true
133
134
  };
134
135
  }
136
+
137
+ /** @internal */
138
+ export function parseUtf8ValidationOption(options?: { enableUtf8Validation?: boolean }): {
139
+ utf8: { writeErrors: false } | false;
140
+ } {
141
+ const enableUtf8Validation = options?.enableUtf8Validation;
142
+ if (enableUtf8Validation === false) {
143
+ return { utf8: false };
144
+ }
145
+ return { utf8: { writeErrors: false } };
146
+ }