mongodb 6.20.0-dev.20251106.sha.696664cb → 6.21.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 (151) hide show
  1. package/README.md +11 -11
  2. package/lib/beta.d.ts +9229 -0
  3. package/lib/beta.js +21 -0
  4. package/lib/beta.js.map +1 -0
  5. package/lib/bulk/common.js +9 -7
  6. package/lib/bulk/common.js.map +1 -1
  7. package/lib/change_stream.js +38 -84
  8. package/lib/change_stream.js.map +1 -1
  9. package/lib/client-side-encryption/auto_encrypter.js +4 -2
  10. package/lib/client-side-encryption/auto_encrypter.js.map +1 -1
  11. package/lib/client-side-encryption/client_encryption.js +3 -2
  12. package/lib/client-side-encryption/client_encryption.js.map +1 -1
  13. package/lib/client-side-encryption/crypto_callbacks.js +81 -0
  14. package/lib/client-side-encryption/crypto_callbacks.js.map +1 -0
  15. package/lib/client-side-encryption/errors.js +1 -3
  16. package/lib/client-side-encryption/errors.js.map +1 -1
  17. package/lib/client-side-encryption/mongocryptd_manager.js +1 -1
  18. package/lib/client-side-encryption/mongocryptd_manager.js.map +1 -1
  19. package/lib/cmap/auth/aws_temporary_credentials.js +58 -10
  20. package/lib/cmap/auth/aws_temporary_credentials.js.map +1 -1
  21. package/lib/cmap/auth/mongo_credentials.js +15 -0
  22. package/lib/cmap/auth/mongo_credentials.js.map +1 -1
  23. package/lib/cmap/auth/mongodb_aws.js +7 -2
  24. package/lib/cmap/auth/mongodb_aws.js.map +1 -1
  25. package/lib/cmap/auth/providers.js +1 -0
  26. package/lib/cmap/auth/providers.js.map +1 -1
  27. package/lib/cmap/connect.js +1 -1
  28. package/lib/cmap/connect.js.map +1 -1
  29. package/lib/cmap/connection.js +27 -28
  30. package/lib/cmap/connection.js.map +1 -1
  31. package/lib/cmap/connection_pool.js +59 -59
  32. package/lib/cmap/connection_pool.js.map +1 -1
  33. package/lib/cmap/errors.js +1 -1
  34. package/lib/cmap/errors.js.map +1 -1
  35. package/lib/cmap/handshake/client_metadata.js +5 -7
  36. package/lib/cmap/handshake/client_metadata.js.map +1 -1
  37. package/lib/cmap/metrics.js +3 -3
  38. package/lib/cmap/metrics.js.map +1 -1
  39. package/lib/cmap/wire_protocol/constants.js +1 -3
  40. package/lib/cmap/wire_protocol/constants.js.map +1 -1
  41. package/lib/cmap/wire_protocol/on_data.js +1 -0
  42. package/lib/cmap/wire_protocol/on_data.js.map +1 -1
  43. package/lib/cmap/wire_protocol/responses.js +2 -2
  44. package/lib/cmap/wire_protocol/responses.js.map +1 -1
  45. package/lib/collection.js +1 -1
  46. package/lib/collection.js.map +1 -1
  47. package/lib/connection_string.js +10 -8
  48. package/lib/connection_string.js.map +1 -1
  49. package/lib/cursor/abstract_cursor.js +34 -17
  50. package/lib/cursor/abstract_cursor.js.map +1 -1
  51. package/lib/cursor/change_stream_cursor.js +2 -2
  52. package/lib/cursor/change_stream_cursor.js.map +1 -1
  53. package/lib/cursor/find_cursor.js +26 -37
  54. package/lib/cursor/find_cursor.js.map +1 -1
  55. package/lib/cursor/run_command_cursor.js +1 -1
  56. package/lib/cursor/run_command_cursor.js.map +1 -1
  57. package/lib/db.js +6 -6
  58. package/lib/db.js.map +1 -1
  59. package/lib/error.js +2 -2
  60. package/lib/error.js.map +1 -1
  61. package/lib/gridfs/download.js +5 -5
  62. package/lib/gridfs/download.js.map +1 -1
  63. package/lib/gridfs/index.js +9 -9
  64. package/lib/gridfs/index.js.map +1 -1
  65. package/lib/gridfs/upload.js +8 -2
  66. package/lib/gridfs/upload.js.map +1 -1
  67. package/lib/index.js +4 -2
  68. package/lib/index.js.map +1 -1
  69. package/lib/mongo_client.js +67 -58
  70. package/lib/mongo_client.js.map +1 -1
  71. package/lib/mongo_client_auth_providers.js +6 -0
  72. package/lib/mongo_client_auth_providers.js.map +1 -1
  73. package/lib/mongo_logger.js.map +1 -1
  74. package/lib/mongo_types.js +2 -1
  75. package/lib/mongo_types.js.map +1 -1
  76. package/lib/operations/aggregate.js +3 -0
  77. package/lib/operations/aggregate.js.map +1 -1
  78. package/lib/operations/command.js.map +1 -1
  79. package/lib/operations/create_collection.js +1 -0
  80. package/lib/operations/create_collection.js.map +1 -1
  81. package/lib/operations/drop.js +9 -8
  82. package/lib/operations/drop.js.map +1 -1
  83. package/lib/operations/execute_operation.js +1 -3
  84. package/lib/operations/execute_operation.js.map +1 -1
  85. package/lib/operations/find.js.map +1 -1
  86. package/lib/read_preference.js +14 -10
  87. package/lib/read_preference.js.map +1 -1
  88. package/lib/resource_management.js +58 -0
  89. package/lib/resource_management.js.map +1 -0
  90. package/lib/sdam/server.js +14 -14
  91. package/lib/sdam/server.js.map +1 -1
  92. package/lib/sdam/srv_polling.js +2 -2
  93. package/lib/sdam/srv_polling.js.map +1 -1
  94. package/lib/sdam/topology.js +68 -24
  95. package/lib/sdam/topology.js.map +1 -1
  96. package/lib/sessions.js +4 -5
  97. package/lib/sessions.js.map +1 -1
  98. package/lib/transactions.js +13 -2
  99. package/lib/transactions.js.map +1 -1
  100. package/lib/utils.js +14 -0
  101. package/lib/utils.js.map +1 -1
  102. package/mongodb.d.ts +244 -72
  103. package/package.json +20 -17
  104. package/src/beta.ts +22 -0
  105. package/src/bulk/common.ts +11 -9
  106. package/src/change_stream.ts +37 -85
  107. package/src/client-side-encryption/auto_encrypter.ts +12 -6
  108. package/src/client-side-encryption/client_encryption.ts +6 -5
  109. package/src/client-side-encryption/crypto_callbacks.ts +87 -0
  110. package/src/client-side-encryption/errors.ts +0 -3
  111. package/src/cmap/auth/aws_temporary_credentials.ts +70 -12
  112. package/src/cmap/auth/mongo_credentials.ts +21 -1
  113. package/src/cmap/auth/mongodb_aws.ts +17 -8
  114. package/src/cmap/auth/providers.ts +1 -0
  115. package/src/cmap/connect.ts +1 -1
  116. package/src/cmap/connection.ts +18 -14
  117. package/src/cmap/connection_pool.ts +13 -4
  118. package/src/cmap/errors.ts +1 -1
  119. package/src/cmap/handshake/client_metadata.ts +26 -18
  120. package/src/cmap/wire_protocol/constants.ts +0 -2
  121. package/src/cmap/wire_protocol/on_data.ts +2 -1
  122. package/src/collection.ts +1 -1
  123. package/src/connection_string.ts +20 -13
  124. package/src/cursor/abstract_cursor.ts +52 -12
  125. package/src/cursor/change_stream_cursor.ts +2 -2
  126. package/src/cursor/find_cursor.ts +27 -40
  127. package/src/cursor/run_command_cursor.ts +1 -1
  128. package/src/error.ts +2 -2
  129. package/src/gridfs/download.ts +4 -0
  130. package/src/gridfs/upload.ts +22 -0
  131. package/src/index.ts +8 -2
  132. package/src/mongo_client.ts +100 -68
  133. package/src/mongo_client_auth_providers.ts +8 -0
  134. package/src/mongo_logger.ts +1 -1
  135. package/src/mongo_types.ts +2 -1
  136. package/src/operations/aggregate.ts +6 -0
  137. package/src/operations/command.ts +12 -0
  138. package/src/operations/create_collection.ts +3 -0
  139. package/src/operations/drop.ts +11 -9
  140. package/src/operations/execute_operation.ts +2 -6
  141. package/src/operations/find.ts +11 -2
  142. package/src/read_preference.ts +9 -0
  143. package/src/resource_management.ts +74 -0
  144. package/src/sdam/topology.ts +60 -2
  145. package/src/sessions.ts +8 -2
  146. package/src/transactions.ts +17 -2
  147. package/src/utils.ts +18 -0
  148. package/tsconfig.json +7 -5
  149. package/lib/operations/end_sessions.js +0 -34
  150. package/lib/operations/end_sessions.js.map +0 -1
  151. package/src/operations/end_sessions.ts +0 -44
package/mongodb.d.ts CHANGED
@@ -69,7 +69,7 @@ export declare type Abortable = {
69
69
  };
70
70
 
71
71
  /** @public */
72
- export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable {
72
+ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable_2 {
73
73
  /* Excluded from this release type: cursorId */
74
74
  /* Excluded from this release type: cursorSession */
75
75
  /* Excluded from this release type: selectedServer */
@@ -114,11 +114,8 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
114
114
  */
115
115
  get killed(): boolean;
116
116
  get loadBalanced(): boolean;
117
- /**
118
- * @experimental
119
- * An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
120
- */
121
- [Symbol.asyncDispose](): Promise<void>;
117
+ /* Excluded from this release type: [Symbol.asyncDispose] */
118
+ /* Excluded from this release type: asyncDispose */
122
119
  /** Adds cursor to client's tracking so it will be closed by MongoClient.close() */
123
120
  private trackCursor;
124
121
  /** Returns current buffered documents length */
@@ -126,7 +123,7 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
126
123
  /** Returns current buffered documents */
127
124
  readBufferedDocuments(number?: number): NonNullable<TSchema>[];
128
125
  [Symbol.asyncIterator](): AsyncGenerator<TSchema, void, void>;
129
- stream(): Readable & AsyncIterable<TSchema>;
126
+ stream(options?: CursorStreamOptions): Readable & AsyncIterable<TSchema>;
130
127
  hasNext(): Promise<boolean>;
131
128
  /** Get the next available document from the cursor, returns null if no more documents are available. */
132
129
  next(): Promise<TSchema | null>;
@@ -631,6 +628,15 @@ export declare type ArrayOperator<Type> = {
631
628
  $sort?: Sort;
632
629
  };
633
630
 
631
+ /**
632
+ * @public
633
+ */
634
+ declare interface AsyncDisposable_2 {
635
+ /* Excluded from this release type: [Symbol.asyncDispose] */
636
+ /* Excluded from this release type: asyncDispose */
637
+ }
638
+ export { AsyncDisposable_2 as AsyncDisposable }
639
+
634
640
  /** @public */
635
641
  export declare interface Auth {
636
642
  /** The username for auth */
@@ -644,6 +650,7 @@ export declare interface Auth {
644
650
  /** @public */
645
651
  export declare const AuthMechanism: Readonly<{
646
652
  readonly MONGODB_AWS: "MONGODB-AWS";
653
+ readonly MONGODB_CR: "MONGODB-CR";
647
654
  readonly MONGODB_DEFAULT: "DEFAULT";
648
655
  readonly MONGODB_GSSAPI: "GSSAPI";
649
656
  readonly MONGODB_PLAIN: "PLAIN";
@@ -662,7 +669,8 @@ export declare interface AuthMechanismProperties extends Document {
662
669
  SERVICE_NAME?: string;
663
670
  SERVICE_REALM?: string;
664
671
  CANONICALIZE_HOST_NAME?: GSSAPICanonicalizationValue;
665
- /* Excluded from this release type: AWS_SESSION_TOKEN */
672
+ /** @deprecated Will be removed in the next major version. */
673
+ AWS_SESSION_TOKEN?: string;
666
674
  /** A user provided OIDC machine callback function. */
667
675
  OIDC_CALLBACK?: OIDCCallbackFunction;
668
676
  /** A user provided OIDC human interacted callback function. */
@@ -780,7 +788,7 @@ export declare interface AutoEncryptionOptions {
780
788
  /** If true, autoEncryption will not attempt to spawn a mongocryptd before connecting */
781
789
  mongocryptdBypassSpawn?: boolean;
782
790
  /** The path to the mongocryptd executable on the system */
783
- mongocryptdSpawnPath?: `${string}mongocryptd${'.exe' | ''}`;
791
+ mongocryptdSpawnPath?: string;
784
792
  /** Command line arguments to use when auto-spawning a mongocryptd */
785
793
  mongocryptdSpawnArgs?: string[];
786
794
  /**
@@ -806,7 +814,7 @@ export declare interface AutoEncryptionOptions {
806
814
  *
807
815
  * Requires the MongoDB Crypt shared library, available in MongoDB 6.0 or higher.
808
816
  */
809
- cryptSharedLibPath?: `${string}mongo_crypt_v${number}.${'so' | 'dll' | 'dylib'}`;
817
+ cryptSharedLibPath?: string;
810
818
  /**
811
819
  * If specified, never use mongocryptd and instead fail when the MongoDB Crypt
812
820
  * shared library could not be loaded.
@@ -1003,7 +1011,6 @@ export declare abstract class BulkOperationBase {
1003
1011
  /* Excluded from this release type: s */
1004
1012
  operationId?: number;
1005
1013
  private collection;
1006
- /* Excluded from this release type: retryWrites */
1007
1014
  /* Excluded from this release type: __constructor */
1008
1015
  /**
1009
1016
  * Add a single insert document to the bulk operation
@@ -1158,18 +1165,23 @@ export declare class BulkWriteResult {
1158
1165
  */
1159
1166
  export declare type Callback<T = any> = (error?: AnyError, result?: T) => void;
1160
1167
 
1161
- /* Excluded from this release type: CancellationToken */
1168
+ /**
1169
+ * @public
1170
+ * @deprecated Will be removed in favor of `AbortSignal` in the next major release.
1171
+ */
1172
+ export declare class CancellationToken extends TypedEventEmitter<{
1173
+ cancel(): void;
1174
+ }> {
1175
+ constructor(...args: any[]);
1176
+ }
1162
1177
 
1163
1178
  /**
1164
1179
  * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
1165
1180
  * @public
1166
1181
  */
1167
- export declare class ChangeStream<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable {
1168
- /**
1169
- * @experimental
1170
- * An alias for {@link ChangeStream.close|ChangeStream.close()}.
1171
- */
1172
- [Symbol.asyncDispose](): Promise<void>;
1182
+ export declare class ChangeStream<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable_2 {
1183
+ /* Excluded from this release type: [Symbol.asyncDispose] */
1184
+ /* Excluded from this release type: asyncDispose */
1173
1185
  pipeline: Document[];
1174
1186
  /**
1175
1187
  * @remarks WriteConcern can still be present on the options because
@@ -1185,6 +1197,7 @@ export declare class ChangeStream<TSchema extends Document = Document, TChange e
1185
1197
  namespace: MongoDBNamespace;
1186
1198
  type: symbol;
1187
1199
  /* Excluded from this release type: cursor */
1200
+ streamOptions?: CursorStreamOptions;
1188
1201
  /* Excluded from this release type: cursorStream */
1189
1202
  /* Excluded from this release type: isClosed */
1190
1203
  /* Excluded from this release type: mode */
@@ -1245,7 +1258,7 @@ export declare class ChangeStream<TSchema extends Document = Document, TChange e
1245
1258
  *
1246
1259
  * @throws MongoChangeStreamError if the underlying cursor or the change stream is closed
1247
1260
  */
1248
- stream(): Readable & AsyncIterable<TChange>;
1261
+ stream(options?: CursorStreamOptions): Readable & AsyncIterable<TChange>;
1249
1262
  /* Excluded from this release type: _setIsEmitter */
1250
1263
  /* Excluded from this release type: _setIsIterator */
1251
1264
  /* Excluded from this release type: _createChangeStreamCursor */
@@ -1886,7 +1899,7 @@ export declare class ClientEncryption {
1886
1899
  * }
1887
1900
  * ```
1888
1901
  */
1889
- rewrapManyDataKey(filter: Filter<DataKey>, options?: ClientEncryptionRewrapManyDataKeyProviderOptions): Promise<{
1902
+ rewrapManyDataKey(filter: Filter<DataKey>, options: ClientEncryptionRewrapManyDataKeyProviderOptions): Promise<{
1890
1903
  bulkWriteResult?: BulkWriteResult;
1891
1904
  }>;
1892
1905
  /**
@@ -2267,7 +2280,48 @@ export declare interface ClientInsertOneResult {
2267
2280
  insertedId: any;
2268
2281
  }
2269
2282
 
2270
- /* Excluded from this release type: ClientMetadata */
2283
+ /**
2284
+ * @public
2285
+ * @deprecated This interface will be made internal in the next major release.
2286
+ * @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.md#hello-command
2287
+ */
2288
+ export declare interface ClientMetadata {
2289
+ driver: {
2290
+ name: string;
2291
+ version: string;
2292
+ };
2293
+ os: {
2294
+ type: string;
2295
+ name?: NodeJS.Platform;
2296
+ architecture?: string;
2297
+ version?: string;
2298
+ };
2299
+ platform: string;
2300
+ application?: {
2301
+ name: string;
2302
+ };
2303
+ /** FaaS environment information */
2304
+ env?: {
2305
+ name: 'aws.lambda' | 'gcp.func' | 'azure.func' | 'vercel';
2306
+ timeout_sec?: Int32;
2307
+ memory_mb?: Int32;
2308
+ region?: string;
2309
+ url?: string;
2310
+ };
2311
+ }
2312
+
2313
+ /**
2314
+ * @public
2315
+ * @deprecated This interface will be made internal in the next major release.
2316
+ */
2317
+ export declare interface ClientMetadataOptions {
2318
+ driverInfo?: {
2319
+ name?: string;
2320
+ version?: string;
2321
+ platform?: string;
2322
+ };
2323
+ appName?: string;
2324
+ }
2271
2325
 
2272
2326
  /** @public */
2273
2327
  export declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
@@ -2295,7 +2349,7 @@ export declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel
2295
2349
  * NOTE: not meant to be instantiated directly.
2296
2350
  * @public
2297
2351
  */
2298
- export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable {
2352
+ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable_2 {
2299
2353
  /* Excluded from this release type: client */
2300
2354
  /* Excluded from this release type: sessionPool */
2301
2355
  hasEnded: boolean;
@@ -2308,7 +2362,8 @@ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents
2308
2362
  explicit: boolean;
2309
2363
  /* Excluded from this release type: owner */
2310
2364
  defaultTransactionOptions: TransactionOptions;
2311
- /* Excluded from this release type: transaction */
2365
+ /** @deprecated - Will be made internal in the next major release */
2366
+ transaction: Transaction;
2312
2367
  /* Excluded from this release type: commitAttempted */
2313
2368
  readonly snapshotEnabled: boolean;
2314
2369
  /* Excluded from this release type: _serverSession */
@@ -2338,11 +2393,8 @@ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents
2338
2393
  * @param options - Optional settings. Currently reserved for future use
2339
2394
  */
2340
2395
  endSession(options?: EndSessionOptions): Promise<void>;
2341
- /**
2342
- * @experimental
2343
- * An alias for {@link ClientSession.endSession|ClientSession.endSession()}.
2344
- */
2345
- [Symbol.asyncDispose](): Promise<void>;
2396
+ /* Excluded from this release type: [Symbol.asyncDispose] */
2397
+ /* Excluded from this release type: asyncDispose */
2346
2398
  /**
2347
2399
  * Advances the operationTime for a ClientSession.
2348
2400
  *
@@ -2563,6 +2615,15 @@ export declare interface ClientWriteModel {
2563
2615
  namespace: string;
2564
2616
  }
2565
2617
 
2618
+ /**
2619
+ * @public
2620
+ * @deprecated This interface is deprecated and will be removed in a future release as it is not used
2621
+ * in the driver
2622
+ */
2623
+ export declare interface CloseOptions {
2624
+ force?: boolean;
2625
+ }
2626
+
2566
2627
  /** @public
2567
2628
  * Configuration options for clustered collections
2568
2629
  * @see https://www.mongodb.com/docs/manual/core/clustered-collections/
@@ -3292,8 +3353,19 @@ export declare interface CommandOperationOptions extends OperationOptions, Write
3292
3353
  * In server versions 4.4 and above, 'comment' can be any valid BSON type.
3293
3354
  */
3294
3355
  comment?: unknown;
3356
+ /**
3357
+ * @deprecated
3358
+ * This option is deprecated and will be removed in a future release as it is not used
3359
+ * in the driver. Use MongoClientOptions or connection string parameters instead.
3360
+ * */
3361
+ retryWrites?: boolean;
3295
3362
  dbName?: string;
3296
3363
  authdb?: string;
3364
+ /**
3365
+ * @deprecated
3366
+ * This option is deprecated and will be removed in an upcoming major version.
3367
+ */
3368
+ noResponse?: boolean;
3297
3369
  /* Excluded from this release type: rawData */
3298
3370
  }
3299
3371
 
@@ -3370,6 +3442,8 @@ export declare type CompressorName = keyof typeof Compressor;
3370
3442
  /** @public */
3371
3443
  export declare type Condition<T> = AlternativeType<T> | FilterOperators<AlternativeType<T>>;
3372
3444
 
3445
+ /* Excluded from this release type: configureExplicitResourceManagement */
3446
+
3373
3447
  /* Excluded from this release type: Connection */
3374
3448
 
3375
3449
  /* Excluded from this release type: CONNECTION_CHECK_OUT_FAILED */
@@ -3510,8 +3584,10 @@ export declare interface ConnectionOptions extends SupportedNodeConnectionOption
3510
3584
  tls: boolean;
3511
3585
  noDelay?: boolean;
3512
3586
  socketTimeoutMS?: number;
3513
- /* Excluded from this release type: cancellationToken */
3514
- /* Excluded from this release type: metadata */
3587
+ /** @deprecated Will be removed in the next major version */
3588
+ cancellationToken?: CancellationToken;
3589
+ metadata: ClientMetadata;
3590
+ /* Excluded from this release type: extendedMetadata */
3515
3591
  /* Excluded from this release type: mongoLogger */
3516
3592
  }
3517
3593
 
@@ -3664,6 +3740,8 @@ export declare interface CountOptions extends CommandOperationOptions {
3664
3740
  export declare interface CreateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
3665
3741
  /** Create a capped collection */
3666
3742
  capped?: boolean;
3743
+ /** @deprecated Create an index on the _id field of the document. This option is deprecated in MongoDB 3.2+ and will be removed once no longer supported by the server. */
3744
+ autoIndexId?: boolean;
3667
3745
  /** The size of the capped collection in bytes */
3668
3746
  size?: number;
3669
3747
  /** The maximum number of documents in the capped collection */
@@ -3769,6 +3847,15 @@ export declare type CursorFlag = (typeof CURSOR_FLAGS)[number];
3769
3847
 
3770
3848
  /* Excluded from this release type: CursorResponse */
3771
3849
 
3850
+ /**
3851
+ * @public
3852
+ * @deprecated Will be removed in the next major version
3853
+ */
3854
+ export declare interface CursorStreamOptions {
3855
+ /** @deprecated Will be removed in the next major version */
3856
+ transform?(this: void, doc: Document): Document;
3857
+ }
3858
+
3772
3859
  /* Excluded from this release type: CursorTimeoutContext */
3773
3860
 
3774
3861
  /**
@@ -4649,7 +4736,14 @@ export declare interface FindOneAndUpdateOptions extends CommandOperationOptions
4649
4736
  }
4650
4737
 
4651
4738
  /** @public */
4652
- export declare type FindOneOptions = Omit<FindOptions, 'batchSize' | 'limit' | 'noCursorTimeout'>;
4739
+ export declare interface FindOneOptions extends FindOptions {
4740
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
4741
+ batchSize?: number;
4742
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
4743
+ limit?: number;
4744
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
4745
+ noCursorTimeout?: boolean;
4746
+ }
4653
4747
 
4654
4748
  /**
4655
4749
  * A builder object that is returned from {@link BulkOperationBase#find}.
@@ -4682,8 +4776,9 @@ export declare class FindOperators {
4682
4776
 
4683
4777
  /**
4684
4778
  * @public
4779
+ * @typeParam TSchema - Unused schema definition, deprecated usage, only specify `FindOptions` with no generic
4685
4780
  */
4686
- export declare interface FindOptions extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
4781
+ export declare interface FindOptions<TSchema extends Document = Document> extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
4687
4782
  /** Sets the limit of documents returned in the query. */
4688
4783
  limit?: number;
4689
4784
  /** Set to sort the documents coming back from the query. Array of indexes, `[['a', 1]]` etc. */
@@ -5034,6 +5129,16 @@ export declare interface GridFSBucketWriteStreamOptions extends WriteConcernOpti
5034
5129
  id?: ObjectId;
5035
5130
  /** Object to store in the file document's `metadata` field */
5036
5131
  metadata?: Document;
5132
+ /**
5133
+ * String to store in the file document's `contentType` field.
5134
+ * @deprecated Will be removed in the next major version. Add a contentType field to the metadata document instead.
5135
+ */
5136
+ contentType?: string;
5137
+ /**
5138
+ * Array of strings to store in the file document's `aliases` field.
5139
+ * @deprecated Will be removed in the next major version. Add an aliases field to the metadata document instead.
5140
+ */
5141
+ aliases?: string[];
5037
5142
  /**
5038
5143
  * @experimental
5039
5144
  * Specifies the time an operation will run until it throws a timeout error
@@ -5057,6 +5162,10 @@ export declare interface GridFSFile {
5057
5162
  filename: string;
5058
5163
  metadata?: Document;
5059
5164
  uploadDate: Date;
5165
+ /** @deprecated Will be removed in the next major version. */
5166
+ contentType?: string;
5167
+ /** @deprecated Will be removed in the next major version. */
5168
+ aliases?: string[];
5060
5169
  }
5061
5170
 
5062
5171
  /** @public */
@@ -5672,7 +5781,7 @@ export declare class MongoChangeStreamError extends MongoRuntimeError {
5672
5781
  * const client = new MongoClient('mongodb://localhost:27017?appName=mflix', { monitorCommands: true });
5673
5782
  * ```
5674
5783
  */
5675
- export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable {
5784
+ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable_2 {
5676
5785
  /* Excluded from this release type: s */
5677
5786
  /* Excluded from this release type: topology */
5678
5787
  /* Excluded from this release type: mongoLogger */
@@ -5681,16 +5790,11 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
5681
5790
  /**
5682
5791
  * The consolidate, parsed, transformed and merged options.
5683
5792
  */
5684
- readonly options: Readonly<Omit<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo'>> & Pick<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo'> & {
5685
- /* Excluded from this release type: metadata */
5686
- };
5793
+ readonly options: Readonly<Omit<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo' | 'additionalDriverInfo' | 'metadata' | 'extendedMetadata'>> & Pick<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo' | 'additionalDriverInfo' | 'metadata' | 'extendedMetadata'>;
5687
5794
  private driverInfoList;
5688
5795
  constructor(url: string, options?: MongoClientOptions);
5689
- /**
5690
- * @experimental
5691
- * An alias for {@link MongoClient.close|MongoClient.close()}.
5692
- */
5693
- [Symbol.asyncDispose](): Promise<void>;
5796
+ /* Excluded from this release type: [Symbol.asyncDispose] */
5797
+ /* Excluded from this release type: asyncDispose */
5694
5798
  /**
5695
5799
  * Append metadata to the client metadata after instantiation.
5696
5800
  * @param driverInfo - Information about the application or library.
@@ -5714,13 +5818,20 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
5714
5818
  */
5715
5819
  bulkWrite<SchemaMap extends Record<string, Document> = Record<string, Document>>(models: ReadonlyArray<ClientBulkWriteModel<SchemaMap>>, options?: ClientBulkWriteOptions): Promise<ClientBulkWriteResult>;
5716
5820
  /**
5717
- * An optional method to verify a handful of assumptions that are generally useful at application boot-time before using a MongoClient.
5718
- * For detailed information about the connect process see the MongoClient.connect static method documentation.
5821
+ * Connect to MongoDB using a url
5822
+ *
5823
+ * @remarks
5824
+ * Calling `connect` is optional since the first operation you perform will call `connect` if it's needed.
5825
+ * `timeoutMS` will bound the time any operation can take before throwing a timeout error.
5826
+ * However, when the operation being run is automatically connecting your `MongoClient` the `timeoutMS` will not apply to the time taken to connect the MongoClient.
5827
+ * This means the time to setup the `MongoClient` does not count against `timeoutMS`.
5828
+ * If you are using `timeoutMS` we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
5719
5829
  *
5720
- * @param url - The MongoDB connection string (supports `mongodb://` and `mongodb+srv://` schemes)
5721
- * @param options - Optional configuration options for the client
5830
+ * @remarks
5831
+ * The driver will look up corresponding SRV and TXT records if the connection string starts with `mongodb+srv://`.
5832
+ * If those look ups throw a DNS Timeout error, the driver will retry the look up once.
5722
5833
  *
5723
- * @see https://www.mongodb.com/docs/manual/reference/connection-string/
5834
+ * @see docs.mongodb.org/manual/reference/connection-string/
5724
5835
  */
5725
5836
  connect(): Promise<this>;
5726
5837
  /* Excluded from this release type: _connect */
@@ -5779,35 +5890,21 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
5779
5890
  */
5780
5891
  db(dbName?: string, options?: DbOptions): Db;
5781
5892
  /**
5782
- * Creates a new MongoClient instance and immediately connects it to MongoDB.
5783
- * This convenience method combines `new MongoClient(url, options)` and `client.connect()` in a single step.
5784
- *
5785
- * Connect can be helpful to detect configuration issues early by validating:
5786
- * - **DNS Resolution**: Verifies that SRV records and hostnames in the connection string resolve DNS entries
5787
- * - **Network Connectivity**: Confirms that host addresses are reachable and ports are open
5788
- * - **TLS Configuration**: Validates SSL/TLS certificates, CA files, and encryption settings are correct
5789
- * - **Authentication**: Verifies that provided credentials are valid
5790
- * - **Server Compatibility**: Ensures the MongoDB server version is supported by this driver version
5791
- * - **Load Balancer Setup**: For load-balanced deployments, confirms the service is properly configured
5792
- *
5793
- * @returns A promise that resolves to the same MongoClient instance once connected
5893
+ * Connect to MongoDB using a url
5794
5894
  *
5795
5895
  * @remarks
5796
- * **Connection is Optional:** Calling `connect` is optional since any operation method (`find`, `insertOne`, etc.)
5797
- * will automatically perform these same validation steps if the client is not already connected.
5798
- * However, explicitly calling `connect` can make sense for:
5799
- * - **Fail-fast Error Detection**: Non-transient connection issues (hostname unresolved, port refused connection) are discovered immediately rather than during your first operation
5800
- * - **Predictable Performance**: Eliminates first connection overhead from your first database operation
5896
+ * Calling `connect` is optional since the first operation you perform will call `connect` if it's needed.
5897
+ * `timeoutMS` will bound the time any operation can take before throwing a timeout error.
5898
+ * However, when the operation being run is automatically connecting your `MongoClient` the `timeoutMS` will not apply to the time taken to connect the MongoClient.
5899
+ * This means the time to setup the `MongoClient` does not count against `timeoutMS`.
5900
+ * If you are using `timeoutMS` we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
5801
5901
  *
5802
5902
  * @remarks
5803
- * **Connection Pooling Impact:** Calling `connect` will populate the connection pool with one connection
5804
- * to a server selected by the client's configured `readPreference` (defaults to primary).
5903
+ * The programmatically provided options take precedence over the URI options.
5805
5904
  *
5806
5905
  * @remarks
5807
- * **Timeout Behavior:** When using `timeoutMS`, the connection establishment time does not count against
5808
- * the timeout for subsequent operations. This means `connect` runs without a `timeoutMS` limit, while
5809
- * your database operations will still respect the configured timeout. If you need predictable operation
5810
- * timing with `timeoutMS`, call `connect` explicitly before performing operations.
5906
+ * The driver will look up corresponding SRV and TXT records if the connection string starts with `mongodb+srv://`.
5907
+ * If those look ups throw a DNS Timeout error, the driver will retry the look up once.
5811
5908
  *
5812
5909
  * @see https://www.mongodb.com/docs/manual/reference/connection-string/
5813
5910
  */
@@ -6575,7 +6672,7 @@ export declare const MongoErrorLabel: Readonly<{
6575
6672
  readonly ResumableChangeStreamError: "ResumableChangeStreamError";
6576
6673
  readonly HandshakeError: "HandshakeError";
6577
6674
  readonly ResetPool: "ResetPool";
6578
- readonly PoolRequestedRetry: "PoolRequestedRetry";
6675
+ readonly PoolRequstedRetry: "PoolRequstedRetry";
6579
6676
  readonly InterruptInUseConnections: "InterruptInUseConnections";
6580
6677
  readonly NoWritesPerformed: "NoWritesPerformed";
6581
6678
  }>;
@@ -6948,7 +7045,12 @@ export declare interface MongoOptions extends Required<Pick<MongoClientOptions,
6948
7045
  compressors: CompressorName[];
6949
7046
  writeConcern: WriteConcern;
6950
7047
  dbName: string;
6951
- /* Excluded from this release type: metadata */
7048
+ /** @deprecated - Will be made internal in a future major release. */
7049
+ metadata: ClientMetadata;
7050
+ /** @deprecated - Will be made internal in a future major release. */
7051
+ extendedMetadata: Promise<Document>;
7052
+ /** @deprecated - Will be made internal in a future major release. */
7053
+ additionalDriverInfo: DriverInfo[];
6952
7054
  /* Excluded from this release type: autoEncrypter */
6953
7055
  /* Excluded from this release type: tokenCache */
6954
7056
  proxyHost?: string;
@@ -7628,6 +7730,10 @@ export declare class ReadPreference {
7628
7730
  tags?: TagSet[];
7629
7731
  hedge?: HedgeOptions;
7630
7732
  maxStalenessSeconds?: number;
7733
+ /**
7734
+ * @deprecated This will be removed as dead code in the next major version.
7735
+ */
7736
+ minWireVersion?: number;
7631
7737
  static PRIMARY: "primary";
7632
7738
  static PRIMARY_PREFERRED: "primaryPreferred";
7633
7739
  static SECONDARY: "secondary";
@@ -7769,6 +7875,21 @@ export declare interface ReplaceOptions extends CommandOperationOptions {
7769
7875
  sort?: Sort;
7770
7876
  }
7771
7877
 
7878
+ /**
7879
+ * @public
7880
+ * @deprecated Please use the ChangeStreamCursorOptions type instead.
7881
+ */
7882
+ export declare interface ResumeOptions {
7883
+ startAtOperationTime?: Timestamp;
7884
+ batchSize?: number;
7885
+ maxAwaitTimeMS?: number;
7886
+ collation?: CollationOptions;
7887
+ readPreference?: ReadPreference;
7888
+ resumeAfter?: ResumeToken;
7889
+ startAfter?: ResumeToken;
7890
+ fullDocument?: string;
7891
+ }
7892
+
7772
7893
  /**
7773
7894
  * Represents the logical starting point for a new ChangeStream or resuming a ChangeStream on the server.
7774
7895
  * @see https://www.mongodb.com/docs/manual/changeStreams/#std-label-change-stream-resume
@@ -7974,6 +8095,25 @@ export declare const ServerApiVersion: Readonly<{
7974
8095
  /** @public */
7975
8096
  export declare type ServerApiVersion = (typeof ServerApiVersion)[keyof typeof ServerApiVersion];
7976
8097
 
8098
+ /**
8099
+ * @public
8100
+ * @deprecated This class will be removed as dead code in the next major version.
8101
+ */
8102
+ export declare class ServerCapabilities {
8103
+ maxWireVersion: number;
8104
+ minWireVersion: number;
8105
+ constructor(hello: Document);
8106
+ get hasAggregationCursor(): boolean;
8107
+ get hasWriteCommands(): boolean;
8108
+ get hasTextSearch(): boolean;
8109
+ get hasAuthCommands(): boolean;
8110
+ get hasListCollectionsCommand(): boolean;
8111
+ get hasListIndexesCommand(): boolean;
8112
+ get supportsSnapshotReads(): boolean;
8113
+ get commandsTakeWriteConcern(): boolean;
8114
+ get commandsTakeCollation(): boolean;
8115
+ }
8116
+
7977
8117
  /**
7978
8118
  * Emitted when server is closed.
7979
8119
  * @public
@@ -8576,7 +8716,39 @@ export declare interface TopologyVersion {
8576
8716
  counter: Long;
8577
8717
  }
8578
8718
 
8579
- /* Excluded from this release type: Transaction */
8719
+ /**
8720
+ * @public
8721
+ * @deprecated - Will be made internal in a future major release.
8722
+ * A class maintaining state related to a server transaction. Internal Only
8723
+ */
8724
+ export declare class Transaction {
8725
+ /* Excluded from this release type: state */
8726
+ /** @deprecated - Will be made internal in a future major release. */
8727
+ options: TransactionOptions;
8728
+ /* Excluded from this release type: _pinnedServer */
8729
+ /* Excluded from this release type: _recoveryToken */
8730
+ /* Excluded from this release type: __constructor */
8731
+ /* Excluded from this release type: server */
8732
+ /** @deprecated - Will be made internal in a future major release. */
8733
+ get recoveryToken(): Document | undefined;
8734
+ /** @deprecated - Will be made internal in a future major release. */
8735
+ get isPinned(): boolean;
8736
+ /**
8737
+ * @deprecated - Will be made internal in a future major release.
8738
+ * @returns Whether the transaction has started
8739
+ */
8740
+ get isStarting(): boolean;
8741
+ /**
8742
+ * @deprecated - Will be made internal in a future major release.
8743
+ * @returns Whether this session is presently in a transaction
8744
+ */
8745
+ get isActive(): boolean;
8746
+ /** @deprecated - Will be made internal in a future major release. */
8747
+ get isCommitted(): boolean;
8748
+ /* Excluded from this release type: transition */
8749
+ /* Excluded from this release type: pinServer */
8750
+ /* Excluded from this release type: unpinServer */
8751
+ }
8580
8752
 
8581
8753
  /**
8582
8754
  * Configuration options for a transaction.