mongodb 6.20.0 → 7.0.0-dev.20251107.sha.5db818c2

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