@mongosh/shell-api 3.29.0 → 5.0.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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
 
3
+ import type { Abortable as Abortable_2 } from 'events';
3
4
  import type { Agent } from 'https';
4
5
  import type { AgentConnectOpts } from 'agent-base';
5
6
  import { Binary } from 'bson';
@@ -70,7 +71,7 @@ declare type Abortable = {
70
71
  };
71
72
 
72
73
  /** @public */
73
- declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable_2 {
74
+ declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable {
74
75
  /* Excluded from this release type: cursorId */
75
76
  /* Excluded from this release type: cursorSession */
76
77
  /* Excluded from this release type: selectedServer */
@@ -115,8 +116,11 @@ declare abstract class AbstractCursor<TSchema = any, CursorEvents extends Abstra
115
116
  */
116
117
  get killed(): boolean;
117
118
  get loadBalanced(): boolean;
118
- /* Excluded from this release type: [Symbol.asyncDispose] */
119
- /* Excluded from this release type: asyncDispose */
119
+ /**
120
+ * @experimental
121
+ * An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
122
+ */
123
+ [Symbol.asyncDispose](): Promise<void>;
120
124
  /** Adds cursor to client's tracking so it will be closed by MongoClient.close() */
121
125
  private trackCursor;
122
126
  /** Returns current buffered documents length */
@@ -124,7 +128,7 @@ declare abstract class AbstractCursor<TSchema = any, CursorEvents extends Abstra
124
128
  /** Returns current buffered documents */
125
129
  readBufferedDocuments(number?: number): NonNullable<TSchema>[];
126
130
  [Symbol.asyncIterator](): AsyncGenerator<TSchema, void, void>;
127
- stream(options?: CursorStreamOptions): Readable & AsyncIterable<TSchema>;
131
+ stream(): Readable & AsyncIterable<TSchema>;
128
132
  hasNext(): Promise<boolean>;
129
133
  /** Get the next available document from the cursor, returns null if no more documents are available. */
130
134
  next(): Promise<TSchema | null>;
@@ -714,14 +718,6 @@ declare type ArrayOperator<Type> = {
714
718
  };
715
719
  declare const asPrintable: unique symbol;
716
720
 
717
- /**
718
- * @public
719
- */
720
- declare interface AsyncDisposable_2 {
721
- /* Excluded from this release type: [Symbol.asyncDispose] */
722
- /* Excluded from this release type: asyncDispose */
723
- }
724
-
725
721
  /** @public */
726
722
  declare interface Auth {
727
723
  /** The username for auth */
@@ -742,7 +738,6 @@ declare type AuthFlowType = 'auth-code' | 'device-auth';
742
738
  /** @public */
743
739
  declare const AuthMechanism: Readonly<{
744
740
  readonly MONGODB_AWS: "MONGODB-AWS";
745
- readonly MONGODB_CR: "MONGODB-CR";
746
741
  readonly MONGODB_DEFAULT: "DEFAULT";
747
742
  readonly MONGODB_GSSAPI: "GSSAPI";
748
743
  readonly MONGODB_PLAIN: "PLAIN";
@@ -761,7 +756,7 @@ declare interface AuthMechanismProperties extends Document_2 {
761
756
  SERVICE_NAME?: string;
762
757
  SERVICE_REALM?: string;
763
758
  CANONICALIZE_HOST_NAME?: GSSAPICanonicalizationValue;
764
- AWS_SESSION_TOKEN?: string;
759
+ /* Excluded from this release type: AWS_SESSION_TOKEN */
765
760
  /** A user provided OIDC machine callback function. */
766
761
  OIDC_CALLBACK?: OIDCCallbackFunction;
767
762
  /** A user provided OIDC human interacted callback function. */
@@ -884,7 +879,7 @@ declare interface AutoEncryptionOptions {
884
879
  /** If true, autoEncryption will not attempt to spawn a mongocryptd before connecting */
885
880
  mongocryptdBypassSpawn?: boolean;
886
881
  /** The path to the mongocryptd executable on the system */
887
- mongocryptdSpawnPath?: string;
882
+ mongocryptdSpawnPath?: `${string}mongocryptd${'.exe' | ''}`;
888
883
  /** Command line arguments to use when auto-spawning a mongocryptd */
889
884
  mongocryptdSpawnArgs?: string[];
890
885
  /**
@@ -910,7 +905,7 @@ declare interface AutoEncryptionOptions {
910
905
  *
911
906
  * Requires the MongoDB Crypt shared library, available in MongoDB 6.0 or higher.
912
907
  */
913
- cryptSharedLibPath?: string;
908
+ cryptSharedLibPath?: `${string}mongo_crypt_v${number}.${'so' | 'dll' | 'dylib'}`;
914
909
  /**
915
910
  * If specified, never use mongocryptd and instead fail when the MongoDB Crypt
916
911
  * shared library could not be loaded.
@@ -1209,6 +1204,7 @@ declare abstract class BulkOperationBase {
1209
1204
  /* Excluded from this release type: s */
1210
1205
  operationId?: number;
1211
1206
  private collection;
1207
+ /* Excluded from this release type: retryWrites */
1212
1208
  /* Excluded from this release type: __constructor */
1213
1209
  /**
1214
1210
  * Add a single insert document to the bulk operation
@@ -1377,23 +1373,16 @@ declare type CacheOptions = {
1377
1373
  aggregationSchemaTTL: number;
1378
1374
  };
1379
1375
 
1380
- /**
1381
- * @public
1382
- * @deprecated Will be removed in favor of `AbortSignal` in the next major release.
1383
- */
1384
- declare class CancellationToken extends TypedEventEmitter<{
1385
- cancel(): void;
1386
- }> {
1387
- constructor(...args: any[]);
1388
- }
1389
-
1390
1376
  /**
1391
1377
  * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
1392
1378
  * @public
1393
1379
  */
1394
- declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange extends Document_2 = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable_2 {
1395
- /* Excluded from this release type: [Symbol.asyncDispose] */
1396
- /* Excluded from this release type: asyncDispose */
1380
+ declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange extends Document_2 = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable {
1381
+ /**
1382
+ * @experimental
1383
+ * An alias for {@link ChangeStream.close|ChangeStream.close()}.
1384
+ */
1385
+ [Symbol.asyncDispose](): Promise<void>;
1397
1386
  pipeline: Document_2[];
1398
1387
  /**
1399
1388
  * @remarks WriteConcern can still be present on the options because
@@ -1409,7 +1398,6 @@ declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange exte
1409
1398
  namespace: MongoDBNamespace;
1410
1399
  type: symbol;
1411
1400
  /* Excluded from this release type: cursor */
1412
- streamOptions?: CursorStreamOptions;
1413
1401
  /* Excluded from this release type: cursorStream */
1414
1402
  /* Excluded from this release type: isClosed */
1415
1403
  /* Excluded from this release type: mode */
@@ -1470,7 +1458,7 @@ declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange exte
1470
1458
  *
1471
1459
  * @throws MongoChangeStreamError if the underlying cursor or the change stream is closed
1472
1460
  */
1473
- stream(options?: CursorStreamOptions): Readable & AsyncIterable<TChange>;
1461
+ stream(): Readable & AsyncIterable<TChange>;
1474
1462
  /* Excluded from this release type: _setIsEmitter */
1475
1463
  /* Excluded from this release type: _setIsIterator */
1476
1464
  /* Excluded from this release type: _createChangeStreamCursor */
@@ -2177,7 +2165,7 @@ declare class ClientEncryption {
2177
2165
  * }
2178
2166
  * ```
2179
2167
  */
2180
- rewrapManyDataKey(filter: Filter<DataKey>, options: ClientEncryptionRewrapManyDataKeyProviderOptions): Promise<{
2168
+ rewrapManyDataKey(filter: Filter<DataKey>, options?: ClientEncryptionRewrapManyDataKeyProviderOptions): Promise<{
2181
2169
  bulkWriteResult?: BulkWriteResult;
2182
2170
  }>;
2183
2171
  /**
@@ -2570,36 +2558,6 @@ declare type ClientInsertResult = {
2570
2558
  insertedId: any;
2571
2559
  };
2572
2560
 
2573
- /**
2574
- * @public
2575
- * @deprecated This interface will be made internal in the next major release.
2576
- * @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.md#hello-command
2577
- */
2578
- declare interface ClientMetadata {
2579
- driver: {
2580
- name: string;
2581
- version: string;
2582
- };
2583
- os: {
2584
- type: string;
2585
- name?: NodeJS.Platform;
2586
- architecture?: string;
2587
- version?: string;
2588
- };
2589
- platform: string;
2590
- application?: {
2591
- name: string;
2592
- };
2593
- /** FaaS environment information */
2594
- env?: {
2595
- name: 'aws.lambda' | 'gcp.func' | 'azure.func' | 'vercel';
2596
- timeout_sec?: Int32;
2597
- memory_mb?: Int32;
2598
- region?: string;
2599
- url?: string;
2600
- };
2601
- }
2602
-
2603
2561
  /** @public */
2604
2562
  declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
2605
2563
  name: 'replaceOne';
@@ -2626,7 +2584,7 @@ declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
2626
2584
  * NOTE: not meant to be instantiated directly.
2627
2585
  * @public
2628
2586
  */
2629
- declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable_2 {
2587
+ declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable {
2630
2588
  /* Excluded from this release type: client */
2631
2589
  /* Excluded from this release type: sessionPool */
2632
2590
  hasEnded: boolean;
@@ -2639,8 +2597,7 @@ declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> imple
2639
2597
  explicit: boolean;
2640
2598
  /* Excluded from this release type: owner */
2641
2599
  defaultTransactionOptions: TransactionOptions;
2642
- /** @deprecated - Will be made internal in the next major release */
2643
- transaction: Transaction;
2600
+ /* Excluded from this release type: transaction */
2644
2601
  /* Excluded from this release type: commitAttempted */
2645
2602
  readonly snapshotEnabled: boolean;
2646
2603
  /* Excluded from this release type: _serverSession */
@@ -2670,8 +2627,11 @@ declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> imple
2670
2627
  * @param options - Optional settings. Currently reserved for future use
2671
2628
  */
2672
2629
  endSession(options?: EndSessionOptions): Promise<void>;
2673
- /* Excluded from this release type: [Symbol.asyncDispose] */
2674
- /* Excluded from this release type: asyncDispose */
2630
+ /**
2631
+ * @experimental
2632
+ * An alias for {@link ClientSession.endSession|ClientSession.endSession()}.
2633
+ */
2634
+ [Symbol.asyncDispose](): Promise<void>;
2675
2635
  /**
2676
2636
  * Advances the operationTime for a ClientSession.
2677
2637
  *
@@ -2964,11 +2924,11 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2964
2924
  */
2965
2925
  aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
2966
2926
  explain: ExplainVerbosityLike;
2967
- }): Document_2;
2927
+ } & Abortable_2): Document_2;
2968
2928
  /*
2969
2929
  Calculates aggregate values for the data in a collection or a view.
2970
2930
  */
2971
- aggregate(pipeline: MQLPipeline, options?: AggregateOptions): AggregationCursor_2;
2931
+ aggregate(pipeline: MQLPipeline, options?: AggregateOptions & Abortable_2): AggregationCursor_2;
2972
2932
  /*
2973
2933
  Calculates aggregate values for the data in a collection or a view.
2974
2934
  */
@@ -2984,7 +2944,7 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2984
2944
  /*
2985
2945
  Returns the count of documents that match the query for a collection or view.
2986
2946
  */
2987
- countDocuments(query?: MQLQuery, options?: CountDocumentsOptions): number;
2947
+ countDocuments(query?: MQLQuery, options?: CountDocumentsOptions & Abortable_2): number;
2988
2948
  /*
2989
2949
  Removes all documents that match the filter from a collection.
2990
2950
  */
@@ -3012,7 +2972,9 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3012
2972
  /*
3013
2973
  Selects documents in a collection or view.
3014
2974
  */
3015
- find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Cursor;
2975
+ find(query?: MQLQuery, projection?: Document_2, options?: FindOptions & {
2976
+ explain?: ExplainVerbosityLike;
2977
+ } & Abortable_2): Cursor;
3016
2978
  /*
3017
2979
  Modifies and returns a single document.
3018
2980
  */
@@ -3020,7 +2982,7 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3020
2982
  /*
3021
2983
  Selects documents in a collection or view.
3022
2984
  */
3023
- findOne(query?: MQLQuery, projection?: Document_2, options?: FindOptions): MQLDocument | null;
2985
+ findOne(query?: MQLQuery, projection?: Document_2, options?: FindOptions & Abortable_2): MQLDocument | null;
3024
2986
  /*
3025
2987
  Renames a collection.
3026
2988
  */
@@ -3311,6 +3273,10 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3311
3273
  declare class Collection_2<TSchema extends Document_2 = Document_2> {
3312
3274
  /* Excluded from this release type: s */
3313
3275
  /* Excluded from this release type: client */
3276
+ /**
3277
+ * Get the database object for the collection.
3278
+ */
3279
+ readonly db: Db;
3314
3280
  /* Excluded from this release type: __constructor */
3315
3281
  /**
3316
3282
  * The name of the database this collection belongs to
@@ -3962,15 +3928,9 @@ declare interface CommandOperationOptions extends OperationOptions, WriteConcern
3962
3928
  * In server versions 4.4 and above, 'comment' can be any valid BSON type.
3963
3929
  */
3964
3930
  comment?: unknown;
3965
- /** Should retry failed writes */
3966
- retryWrites?: boolean;
3967
3931
  dbName?: string;
3968
3932
  authdb?: string;
3969
- /**
3970
- * @deprecated
3971
- * This option is deprecated and will be removed in an upcoming major version.
3972
- */
3973
- noResponse?: boolean;
3933
+ /* Excluded from this release type: rawData */
3974
3934
  }
3975
3935
  declare class CommandResult<T = unknown> extends ShellApiValueClass {
3976
3936
  value: T;
@@ -4270,9 +4230,8 @@ declare interface ConnectionOptions_2 extends SupportedNodeConnectionOptions, St
4270
4230
  tls: boolean;
4271
4231
  noDelay?: boolean;
4272
4232
  socketTimeoutMS?: number;
4273
- cancellationToken?: CancellationToken;
4274
- metadata: ClientMetadata;
4275
- /* Excluded from this release type: extendedMetadata */
4233
+ /* Excluded from this release type: cancellationToken */
4234
+ /* Excluded from this release type: metadata */
4276
4235
  /* Excluded from this release type: mongoLogger */
4277
4236
  }
4278
4237
 
@@ -4445,11 +4404,9 @@ declare interface CountOptions extends CommandOperationOptions {
4445
4404
  }
4446
4405
 
4447
4406
  /** @public */
4448
- declare interface CreateCollectionOptions extends CommandOperationOptions {
4407
+ declare interface CreateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
4449
4408
  /** Create a capped collection */
4450
4409
  capped?: boolean;
4451
- /** @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. */
4452
- autoIndexId?: boolean;
4453
4410
  /** The size of the capped collection in bytes */
4454
4411
  size?: number;
4455
4412
  /** The maximum number of documents in the capped collection */
@@ -4668,12 +4625,6 @@ declare class CursorIterationResult extends ShellApiValueClass {
4668
4625
  constructor();
4669
4626
  }
4670
4627
 
4671
- /** @public */
4672
- declare interface CursorStreamOptions {
4673
- /** A transformation method applied to each document emitted by the stream */
4674
- transform?(this: void, doc: Document_2): Document_2;
4675
- }
4676
-
4677
4628
  /**
4678
4629
  * @public
4679
4630
  * @experimental
@@ -4725,15 +4676,15 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
4725
4676
  _maybeCachedHello(): Promise<Document_2>;
4726
4677
  [asPrintable](): string;
4727
4678
  private _emitDatabaseApiCall;
4728
- _runCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4729
- _runReadCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4730
- _runAdminCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4731
- _runAdminReadCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4679
+ _runCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4680
+ _runReadCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4681
+ _runAdminCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4682
+ _runAdminReadCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4732
4683
  _runCursorCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<RunCommandCursor_2>;
4733
4684
  _runAdminCursorCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<RunCommandCursor_2>;
4734
- _listCollections(filter: Document_2, options: ListCollectionsOptions): Promise<Document_2[]>;
4735
- _getCollectionNames(options?: ListCollectionsOptions): Promise<string[]>;
4736
- _getCollectionNamesWithTypes(options?: ListCollectionsOptions): Promise<CollectionNamesWithTypes[]>;
4685
+ _listCollections(filter: Document_2, options: ListCollectionsOptions & Abortable_2): Promise<Document_2[]>;
4686
+ _getCollectionNames(options?: ListCollectionsOptions & Abortable_2): Promise<string[]>;
4687
+ _getCollectionNamesWithTypes(options?: ListCollectionsOptions & Abortable_2): Promise<CollectionNamesWithTypes[]>;
4737
4688
  _getCollectionNamesForCompletion(): Promise<string[]>;
4738
4689
  _getLastErrorObj(w?: number | string, wTimeout?: number, j?: boolean): Promise<Document_2>;
4739
4690
  /*
@@ -4751,11 +4702,11 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
4751
4702
  /*
4752
4703
  Returns an array of documents with collection information, i.e. collection name and options, for the current database.
4753
4704
  */
4754
- getCollectionInfos(filter?: Document_2, options?: ListCollectionsOptions): Document_2[];
4705
+ getCollectionInfos(filter?: Document_2, options?: ListCollectionsOptions & Abortable_2): Document_2[];
4755
4706
  /*
4756
4707
  Runs an arbitrary command on the database.
4757
4708
  */
4758
- runCommand(cmd: string | Document_2, options?: RunCommandOptions): Document_2;
4709
+ runCommand(cmd: string | Document_2, options?: RunCommandOptions & Abortable_2): Document_2;
4759
4710
  /*
4760
4711
  Runs an arbitrary command against the admin database.
4761
4712
  */
@@ -4765,11 +4716,11 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
4765
4716
  */
4766
4717
  aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
4767
4718
  explain: ExplainVerbosityLike;
4768
- }): Document_2;
4719
+ } & Abortable_2): Document_2;
4769
4720
  /*
4770
4721
  Runs a specified admin/diagnostic pipeline which does not require an underlying collection.
4771
4722
  */
4772
- aggregate(pipeline: MQLPipeline, options?: AggregateOptions): AggregationCursor_2;
4723
+ aggregate(pipeline: MQLPipeline, options?: AggregateOptions & Abortable_2): AggregationCursor_2;
4773
4724
  /*
4774
4725
  Runs a specified admin/diagnostic pipeline which does not require an underlying collection.
4775
4726
  */
@@ -5083,7 +5034,11 @@ declare type DataKeyEncryptionKeyOptions = {
5083
5034
  */
5084
5035
  declare class Db {
5085
5036
  /* Excluded from this release type: s */
5086
- /* Excluded from this release type: client */
5037
+ /**
5038
+ * Gets the MongoClient associated with the Db.
5039
+ * @public
5040
+ */
5041
+ readonly client: MongoClient;
5087
5042
  static SYSTEM_NAMESPACE_COLLECTION: string;
5088
5043
  static SYSTEM_INDEX_COLLECTION: string;
5089
5044
  static SYSTEM_PROFILE_COLLECTION: string;
@@ -5369,7 +5324,7 @@ declare class DBQuery extends ShellApiClass {
5369
5324
  }
5370
5325
 
5371
5326
  /** @public */
5372
- declare interface DbStatsOptions extends CommandOperationOptions {
5327
+ declare interface DbStatsOptions extends Omit<CommandOperationOptions, 'rawData'> {
5373
5328
  /** Divide the returned sizes by scale value. */
5374
5329
  scale?: number;
5375
5330
  }
@@ -5458,6 +5413,7 @@ declare interface DevtoolsConnectOptions extends MongoClientOptions {
5458
5413
  parentHandle?: string;
5459
5414
  proxy?: DevtoolsProxyOptions | AgentWithInitialize;
5460
5415
  applyProxyToOIDC?: boolean | DevtoolsProxyOptions | AgentWithInitialize;
5416
+ useSystemCA?: boolean;
5461
5417
  }
5462
5418
  declare interface DevtoolsProxyOptions {
5463
5419
  proxy?: string;
@@ -5496,7 +5452,7 @@ declare interface DriverInfo {
5496
5452
  }
5497
5453
 
5498
5454
  /** @public */
5499
- declare interface DropCollectionOptions extends CommandOperationOptions {
5455
+ declare interface DropCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
5500
5456
  /** @experimental */
5501
5457
  encryptedFields?: Document_2;
5502
5458
  }
@@ -5586,7 +5542,9 @@ declare class Explainable extends ShellApiWithMongoClass {
5586
5542
  /*
5587
5543
  Returns information on the query plan.
5588
5544
  */
5589
- find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): ExplainableCursor_2;
5545
+ find(query?: MQLQuery, projection?: Document_2, options?: FindOptions & {
5546
+ explain?: ExplainVerbosityLike;
5547
+ }): ExplainableCursor_2;
5590
5548
  /*
5591
5549
  Provides information on the query plan for db.collection.aggregate() method.
5592
5550
  */
@@ -6037,14 +5995,7 @@ declare interface FindOneAndUpdateOptions extends CommandOperationOptions {
6037
5995
  }
6038
5996
 
6039
5997
  /** @public */
6040
- declare interface FindOneOptions extends FindOptions {
6041
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
6042
- batchSize?: number;
6043
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
6044
- limit?: number;
6045
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
6046
- noCursorTimeout?: boolean;
6047
- }
5998
+ declare type FindOneOptions = Omit<FindOptions, 'batchSize' | 'limit' | 'noCursorTimeout'>;
6048
5999
 
6049
6000
  /**
6050
6001
  * A builder object that is returned from {@link BulkOperationBase#find}.
@@ -6077,9 +6028,8 @@ declare class FindOperators {
6077
6028
 
6078
6029
  /**
6079
6030
  * @public
6080
- * @typeParam TSchema - Unused schema definition, deprecated usage, only specify `FindOptions` with no generic
6081
6031
  */
6082
- declare interface FindOptions<TSchema extends Document_2 = Document_2> extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
6032
+ declare interface FindOptions extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
6083
6033
  /** Sets the limit of documents returned in the query. */
6084
6034
  limit?: number;
6085
6035
  /** Set to sort the documents coming back from the query. Array of indexes, `[['a', 1]]` etc. */
@@ -6818,7 +6768,7 @@ declare interface ListCollectionsOptions extends Omit<CommandOperationOptions, '
6818
6768
  }
6819
6769
 
6820
6770
  /** @public */
6821
- declare interface ListDatabasesOptions extends CommandOperationOptions {
6771
+ declare interface ListDatabasesOptions extends Omit<CommandOperationOptions, 'rawData'> {
6822
6772
  /** A query predicate that determines which databases are listed */
6823
6773
  filter?: Document_2;
6824
6774
  /** A flag to indicate whether the command should return just the database names, or return both database names and size information */
@@ -6851,6 +6801,7 @@ declare class ListIndexesCursor extends AbstractCursor {
6851
6801
  /** @public */
6852
6802
  declare type ListIndexesOptions = AbstractCursorOptions & {
6853
6803
  /* Excluded from this release type: omitMaxTimeMS */
6804
+ /* Excluded from this release type: rawData */
6854
6805
  };
6855
6806
 
6856
6807
  /** @public */
@@ -7094,7 +7045,7 @@ declare const MONGO_CLIENT_EVENTS: readonly ["connectionPoolCreated", "connectio
7094
7045
  * const client = new MongoClient('mongodb://localhost:27017?appName=mflix', { monitorCommands: true });
7095
7046
  * ```
7096
7047
  */
7097
- declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable_2 {
7048
+ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable {
7098
7049
  /* Excluded from this release type: s */
7099
7050
  /* Excluded from this release type: topology */
7100
7051
  /* Excluded from this release type: mongoLogger */
@@ -7103,10 +7054,16 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
7103
7054
  /**
7104
7055
  * The consolidate, parsed, transformed and merged options.
7105
7056
  */
7106
- 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'>;
7057
+ readonly options: Readonly<Omit<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo'>> & Pick<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo'> & {
7058
+ /* Excluded from this release type: metadata */
7059
+ };
7060
+ private driverInfoList;
7107
7061
  constructor(url: string, options?: MongoClientOptions);
7108
- /* Excluded from this release type: [Symbol.asyncDispose] */
7109
- /* Excluded from this release type: asyncDispose */
7062
+ /**
7063
+ * @experimental
7064
+ * An alias for {@link MongoClient.close|MongoClient.close()}.
7065
+ */
7066
+ [Symbol.asyncDispose](): Promise<void>;
7110
7067
  /**
7111
7068
  * Append metadata to the client metadata after instantiation.
7112
7069
  * @param driverInfo - Information about the application or library.
@@ -7130,20 +7087,13 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
7130
7087
  */
7131
7088
  bulkWrite<SchemaMap extends Record<string, Document_2> = Record<string, Document_2>>(models: ReadonlyArray<ClientBulkWriteModel<SchemaMap>>, options?: ClientBulkWriteOptions): Promise<ClientBulkWriteResult>;
7132
7089
  /**
7133
- * Connect to MongoDB using a url
7090
+ * An optional method to verify a handful of assumptions that are generally useful at application boot-time before using a MongoClient.
7091
+ * For detailed information about the connect process see the MongoClient.connect static method documentation.
7134
7092
  *
7135
- * @remarks
7136
- * Calling `connect` is optional since the first operation you perform will call `connect` if it's needed.
7137
- * `timeoutMS` will bound the time any operation can take before throwing a timeout error.
7138
- * However, when the operation being run is automatically connecting your `MongoClient` the `timeoutMS` will not apply to the time taken to connect the MongoClient.
7139
- * This means the time to setup the `MongoClient` does not count against `timeoutMS`.
7140
- * If you are using `timeoutMS` we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
7093
+ * @param url - The MongoDB connection string (supports `mongodb://` and `mongodb+srv://` schemes)
7094
+ * @param options - Optional configuration options for the client
7141
7095
  *
7142
- * @remarks
7143
- * The driver will look up corresponding SRV and TXT records if the connection string starts with `mongodb+srv://`.
7144
- * If those look ups throw a DNS Timeout error, the driver will retry the look up once.
7145
- *
7146
- * @see docs.mongodb.org/manual/reference/connection-string/
7096
+ * @see https://www.mongodb.com/docs/manual/reference/connection-string/
7147
7097
  */
7148
7098
  connect(): Promise<this>;
7149
7099
  /* Excluded from this release type: _connect */
@@ -7202,21 +7152,35 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
7202
7152
  */
7203
7153
  db(dbName?: string, options?: DbOptions): Db;
7204
7154
  /**
7205
- * Connect to MongoDB using a url
7155
+ * Creates a new MongoClient instance and immediately connects it to MongoDB.
7156
+ * This convenience method combines `new MongoClient(url, options)` and `client.connect()` in a single step.
7157
+ *
7158
+ * Connect can be helpful to detect configuration issues early by validating:
7159
+ * - **DNS Resolution**: Verifies that SRV records and hostnames in the connection string resolve DNS entries
7160
+ * - **Network Connectivity**: Confirms that host addresses are reachable and ports are open
7161
+ * - **TLS Configuration**: Validates SSL/TLS certificates, CA files, and encryption settings are correct
7162
+ * - **Authentication**: Verifies that provided credentials are valid
7163
+ * - **Server Compatibility**: Ensures the MongoDB server version is supported by this driver version
7164
+ * - **Load Balancer Setup**: For load-balanced deployments, confirms the service is properly configured
7165
+ *
7166
+ * @returns A promise that resolves to the same MongoClient instance once connected
7206
7167
  *
7207
7168
  * @remarks
7208
- * Calling `connect` is optional since the first operation you perform will call `connect` if it's needed.
7209
- * `timeoutMS` will bound the time any operation can take before throwing a timeout error.
7210
- * However, when the operation being run is automatically connecting your `MongoClient` the `timeoutMS` will not apply to the time taken to connect the MongoClient.
7211
- * This means the time to setup the `MongoClient` does not count against `timeoutMS`.
7212
- * If you are using `timeoutMS` we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
7169
+ * **Connection is Optional:** Calling `connect` is optional since any operation method (`find`, `insertOne`, etc.)
7170
+ * will automatically perform these same validation steps if the client is not already connected.
7171
+ * However, explicitly calling `connect` can make sense for:
7172
+ * - **Fail-fast Error Detection**: Non-transient connection issues (hostname unresolved, port refused connection) are discovered immediately rather than during your first operation
7173
+ * - **Predictable Performance**: Eliminates first connection overhead from your first database operation
7213
7174
  *
7214
7175
  * @remarks
7215
- * The programmatically provided options take precedence over the URI options.
7176
+ * **Connection Pooling Impact:** Calling `connect` will populate the connection pool with one connection
7177
+ * to a server selected by the client's configured `readPreference` (defaults to primary).
7216
7178
  *
7217
7179
  * @remarks
7218
- * The driver will look up corresponding SRV and TXT records if the connection string starts with `mongodb+srv://`.
7219
- * If those look ups throw a DNS Timeout error, the driver will retry the look up once.
7180
+ * **Timeout Behavior:** When using `timeoutMS`, the connection establishment time does not count against
7181
+ * the timeout for subsequent operations. This means `connect` runs without a `timeoutMS` limit, while
7182
+ * your database operations will still respect the configured timeout. If you need predictable operation
7183
+ * timing with `timeoutMS`, call `connect` explicitly before performing operations.
7220
7184
  *
7221
7185
  * @see https://www.mongodb.com/docs/manual/reference/connection-string/
7222
7186
  */
@@ -7461,7 +7425,10 @@ declare interface MongoClientOptions extends BSONSerializeOptions, SupportedNode
7461
7425
  * If an internal MongoClient is created, it is configured with the same options as the parent MongoClient except minPoolSize is set to 0 and AutoEncryptionOptions is omitted.
7462
7426
  */
7463
7427
  autoEncryption?: AutoEncryptionOptions;
7464
- /** Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver */
7428
+ /**
7429
+ * Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver
7430
+ /* @deprecated - Will be made internal in a future major release.
7431
+ */
7465
7432
  driverInfo?: DriverInfo;
7466
7433
  /** Configures a Socks5 proxy host used for creating TCP connections. */
7467
7434
  proxyHost?: string;
@@ -8002,10 +7969,7 @@ declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEn
8002
7969
  compressors: CompressorName[];
8003
7970
  writeConcern: WriteConcern;
8004
7971
  dbName: string;
8005
- /** @deprecated - Will be made internal in a future major release. */
8006
- metadata: ClientMetadata;
8007
- extendedMetadata: Promise<Document_2>;
8008
- additionalDriverInfo: DriverInfo[];
7972
+ /* Excluded from this release type: metadata */
8009
7973
  /* Excluded from this release type: autoEncrypter */
8010
7974
  /* Excluded from this release type: tokenCache */
8011
7975
  proxyHost?: string;
@@ -8347,7 +8311,7 @@ declare const ProfilingLevel: Readonly<{
8347
8311
  declare type ProfilingLevel = (typeof ProfilingLevel)[keyof typeof ProfilingLevel];
8348
8312
 
8349
8313
  /** @public */
8350
- declare type ProfilingLevelOptions = CommandOperationOptions;
8314
+ declare type ProfilingLevelOptions = Omit<CommandOperationOptions, 'rawData'>;
8351
8315
  declare type ProxyEventArgs<K extends keyof ProxyEventMap> = ProxyEventMap[K] extends ((...args: infer P) => any) ? P : never;
8352
8316
  declare interface ProxyEventMap {
8353
8317
  'socks5:authentication-complete': (ev: {
@@ -8441,16 +8405,16 @@ declare interface RangeOptions {
8441
8405
  precision?: number;
8442
8406
  }
8443
8407
  declare interface Readable_2 {
8444
- aggregate(database: string, collection: string, pipeline: Document_2[], options?: AggregateOptions, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
8445
- aggregateDb(database: string, pipeline: Document_2[], options?: AggregateOptions, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
8408
+ aggregate(database: string, collection: string, pipeline: Document_2[], options?: AggregateOptions & Abortable_2, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
8409
+ aggregateDb(database: string, pipeline: Document_2[], options?: AggregateOptions & Abortable_2, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
8446
8410
  count(db: string, coll: string, query?: Document_2, options?: CountOptions, dbOptions?: DbOptions): Promise<number>;
8447
- countDocuments(database: string, collection: string, filter?: Document_2, options?: CountDocumentsOptions, dbOptions?: DbOptions): Promise<number>;
8411
+ countDocuments(database: string, collection: string, filter?: Document_2, options?: CountDocumentsOptions & Abortable_2, dbOptions?: DbOptions): Promise<number>;
8448
8412
  distinct(database: string, collection: string, fieldName: string, filter?: Document_2, options?: DistinctOptions, dbOptions?: DbOptions): Promise<Document_2>;
8449
8413
  estimatedDocumentCount(database: string, collection: string, options?: EstimatedDocumentCountOptions, dbOptions?: DbOptions): Promise<number>;
8450
- find(database: string, collection: string, filter?: Document_2, options?: FindOptions, dbOptions?: DbOptions): ServiceProviderFindCursor;
8414
+ find(database: string, collection: string, filter?: Document_2, options?: FindOptions & Abortable_2, dbOptions?: DbOptions): ServiceProviderFindCursor;
8451
8415
  getTopologyDescription(): TopologyDescription_2 | undefined;
8452
8416
  getIndexes(database: string, collection: string, options: ListIndexesOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
8453
- listCollections(database: string, filter?: Document_2, options?: ListCollectionsOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
8417
+ listCollections(database: string, filter?: Document_2, options?: ListCollectionsOptions & Abortable_2, dbOptions?: DbOptions): Promise<Document_2[]>;
8454
8418
  readPreferenceFromOptions(options?: Omit<ReadPreferenceFromOptions, 'session'>): ReadPreferenceLike | undefined;
8455
8419
  watch(pipeline: Document_2[], options: ChangeStreamOptions, dbOptions?: DbOptions, db?: string, coll?: string): ServiceProviderChangeStream;
8456
8420
  getSearchIndexes(database: string, collection: string, indexName?: string, options?: Document_2, dbOptions?: DbOptions): Promise<Document_2[]>;
@@ -8512,7 +8476,6 @@ declare class ReadPreference {
8512
8476
  tags?: TagSet[];
8513
8477
  hedge?: HedgeOptions;
8514
8478
  maxStalenessSeconds?: number;
8515
- minWireVersion?: number;
8516
8479
  static PRIMARY: "primary";
8517
8480
  static PRIMARY_PREFERRED: "primaryPreferred";
8518
8481
  static SECONDARY: "secondary";
@@ -8643,13 +8606,18 @@ declare type RemoveShellOptions = DeleteOptions & {
8643
8606
  };
8644
8607
 
8645
8608
  /** @public */
8646
- declare type RemoveUserOptions = CommandOperationOptions;
8609
+ declare type RemoveUserOptions = Omit<CommandOperationOptions, 'rawData'>;
8647
8610
 
8648
8611
  /** @public */
8649
- declare interface RenameOptions extends CommandOperationOptions {
8612
+ declare interface RenameOptions extends Omit<CommandOperationOptions, 'rawData'> {
8650
8613
  /** Drop the target name collection if it previously exists. */
8651
8614
  dropTarget?: boolean;
8652
- /** Unclear */
8615
+ /**
8616
+ * @deprecated
8617
+ *
8618
+ * This option has been dead code since at least Node driver version 4.x. It will
8619
+ * be removed in a future major release.
8620
+ */
8653
8621
  new_collection?: boolean;
8654
8622
  }
8655
8623
 
@@ -9289,7 +9257,7 @@ declare type SetFields<TSchema> = ({ readonly [key in KeysOfAType<TSchema, Reado
9289
9257
  };
9290
9258
 
9291
9259
  /** @public */
9292
- declare type SetProfilingLevelOptions = CommandOperationOptions;
9260
+ declare type SetProfilingLevelOptions = Omit<CommandOperationOptions, 'rawData'>;
9293
9261
 
9294
9262
  /**
9295
9263
  * @public
@@ -10156,40 +10124,6 @@ declare interface TopologyVersion {
10156
10124
  counter: Long;
10157
10125
  }
10158
10126
 
10159
- /**
10160
- * @public
10161
- * @deprecated - Will be made internal in a future major release.
10162
- * A class maintaining state related to a server transaction. Internal Only
10163
- */
10164
- declare class Transaction {
10165
- /* Excluded from this release type: state */
10166
- /** @deprecated - Will be made internal in a future major release. */
10167
- options: TransactionOptions;
10168
- /* Excluded from this release type: _pinnedServer */
10169
- /* Excluded from this release type: _recoveryToken */
10170
- /* Excluded from this release type: __constructor */
10171
- /* Excluded from this release type: server */
10172
- /** @deprecated - Will be made internal in a future major release. */
10173
- get recoveryToken(): Document_2 | undefined;
10174
- /** @deprecated - Will be made internal in a future major release. */
10175
- get isPinned(): boolean;
10176
- /**
10177
- * @deprecated - Will be made internal in a future major release.
10178
- * @returns Whether the transaction has started
10179
- */
10180
- get isStarting(): boolean;
10181
- /**
10182
- * @deprecated - Will be made internal in a future major release.
10183
- * @returns Whether this session is presently in a transaction
10184
- */
10185
- get isActive(): boolean;
10186
- /** @deprecated - Will be made internal in a future major release. */
10187
- get isCommitted(): boolean;
10188
- /* Excluded from this release type: transition */
10189
- /* Excluded from this release type: pinServer */
10190
- /* Excluded from this release type: unpinServer */
10191
- }
10192
-
10193
10127
  /**
10194
10128
  * Configuration options for a transaction.
10195
10129
  * @public
@@ -10449,7 +10383,7 @@ declare interface UseEvent {
10449
10383
  }
10450
10384
 
10451
10385
  /** @public */
10452
- declare interface ValidateCollectionOptions extends CommandOperationOptions {
10386
+ declare interface ValidateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
10453
10387
  /** Validates a collection in the background, without interrupting read or write traffic (only in MongoDB 4.4+) */
10454
10388
  background?: boolean;
10455
10389
  }
@@ -10475,8 +10409,8 @@ declare type WorkspaceDefaults = {
10475
10409
  maxTierSize: string;
10476
10410
  };
10477
10411
  declare interface Writable {
10478
- runCommand(db: string, spec: Document_2, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document_2>;
10479
- runCommandWithCheck(db: string, spec: Document_2, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document_2>;
10412
+ runCommand(db: string, spec: Document_2, options: RunCommandOptions & Abortable_2, dbOptions?: DbOptions): Promise<Document_2>;
10413
+ runCommandWithCheck(db: string, spec: Document_2, options: RunCommandOptions & Abortable_2, dbOptions?: DbOptions): Promise<Document_2>;
10480
10414
  runCursorCommand(db: string, spec: Document_2, options: RunCursorCommandOptions, dbOptions?: DbOptions): ServiceProviderRunCommandCursor;
10481
10415
  dropDatabase(database: string, options: DropDatabaseOptions, dbOptions?: DbOptions): Promise<Document_2>;
10482
10416
  bulkWrite(database: string, collection: string, requests: AnyBulkWriteOperation[], options: BulkWriteOptions, dbOptions?: DbOptions): Promise<BulkWriteResult>;