@mongosh/shell-api 3.29.1 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/api-raw.d.ts CHANGED
@@ -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>;
@@ -707,14 +711,6 @@ declare type ArrayOperator<Type> = {
707
711
 
708
712
  declare const asPrintable: unique symbol;
709
713
 
710
- /**
711
- * @public
712
- */
713
- declare interface AsyncDisposable_2 {
714
- /* Excluded from this release type: [Symbol.asyncDispose] */
715
- /* Excluded from this release type: asyncDispose */
716
- }
717
-
718
714
  /** @public */
719
715
  declare interface Auth {
720
716
  /** The username for auth */
@@ -736,7 +732,6 @@ declare type AuthFlowType = 'auth-code' | 'device-auth';
736
732
  /** @public */
737
733
  declare const AuthMechanism: Readonly<{
738
734
  readonly MONGODB_AWS: "MONGODB-AWS";
739
- readonly MONGODB_CR: "MONGODB-CR";
740
735
  readonly MONGODB_DEFAULT: "DEFAULT";
741
736
  readonly MONGODB_GSSAPI: "GSSAPI";
742
737
  readonly MONGODB_PLAIN: "PLAIN";
@@ -755,7 +750,7 @@ declare interface AuthMechanismProperties extends Document_2 {
755
750
  SERVICE_NAME?: string;
756
751
  SERVICE_REALM?: string;
757
752
  CANONICALIZE_HOST_NAME?: GSSAPICanonicalizationValue;
758
- AWS_SESSION_TOKEN?: string;
753
+ /* Excluded from this release type: AWS_SESSION_TOKEN */
759
754
  /** A user provided OIDC machine callback function. */
760
755
  OIDC_CALLBACK?: OIDCCallbackFunction;
761
756
  /** A user provided OIDC human interacted callback function. */
@@ -880,7 +875,7 @@ declare interface AutoEncryptionOptions {
880
875
  /** If true, autoEncryption will not attempt to spawn a mongocryptd before connecting */
881
876
  mongocryptdBypassSpawn?: boolean;
882
877
  /** The path to the mongocryptd executable on the system */
883
- mongocryptdSpawnPath?: string;
878
+ mongocryptdSpawnPath?: `${string}mongocryptd${'.exe' | ''}`;
884
879
  /** Command line arguments to use when auto-spawning a mongocryptd */
885
880
  mongocryptdSpawnArgs?: string[];
886
881
  /**
@@ -906,7 +901,7 @@ declare interface AutoEncryptionOptions {
906
901
  *
907
902
  * Requires the MongoDB Crypt shared library, available in MongoDB 6.0 or higher.
908
903
  */
909
- cryptSharedLibPath?: string;
904
+ cryptSharedLibPath?: `${string}mongo_crypt_v${number}.${'so' | 'dll' | 'dylib'}`;
910
905
  /**
911
906
  * If specified, never use mongocryptd and instead fail when the MongoDB Crypt
912
907
  * shared library could not be loaded.
@@ -1161,6 +1156,7 @@ declare abstract class BulkOperationBase {
1161
1156
  /* Excluded from this release type: s */
1162
1157
  operationId?: number;
1163
1158
  private collection;
1159
+ /* Excluded from this release type: retryWrites */
1164
1160
  /* Excluded from this release type: __constructor */
1165
1161
  /**
1166
1162
  * Add a single insert document to the bulk operation
@@ -1331,23 +1327,16 @@ declare type CacheOptions = {
1331
1327
  aggregationSchemaTTL: number;
1332
1328
  };
1333
1329
 
1334
- /**
1335
- * @public
1336
- * @deprecated Will be removed in favor of `AbortSignal` in the next major release.
1337
- */
1338
- declare class CancellationToken extends TypedEventEmitter<{
1339
- cancel(): void;
1340
- }> {
1341
- constructor(...args: any[]);
1342
- }
1343
-
1344
1330
  /**
1345
1331
  * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
1346
1332
  * @public
1347
1333
  */
1348
- declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange extends Document_2 = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable_2 {
1349
- /* Excluded from this release type: [Symbol.asyncDispose] */
1350
- /* Excluded from this release type: asyncDispose */
1334
+ declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange extends Document_2 = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable {
1335
+ /**
1336
+ * @experimental
1337
+ * An alias for {@link ChangeStream.close|ChangeStream.close()}.
1338
+ */
1339
+ [Symbol.asyncDispose](): Promise<void>;
1351
1340
  pipeline: Document_2[];
1352
1341
  /**
1353
1342
  * @remarks WriteConcern can still be present on the options because
@@ -1363,7 +1352,6 @@ declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange exte
1363
1352
  namespace: MongoDBNamespace;
1364
1353
  type: symbol;
1365
1354
  /* Excluded from this release type: cursor */
1366
- streamOptions?: CursorStreamOptions;
1367
1355
  /* Excluded from this release type: cursorStream */
1368
1356
  /* Excluded from this release type: isClosed */
1369
1357
  /* Excluded from this release type: mode */
@@ -1424,7 +1412,7 @@ declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange exte
1424
1412
  *
1425
1413
  * @throws MongoChangeStreamError if the underlying cursor or the change stream is closed
1426
1414
  */
1427
- stream(options?: CursorStreamOptions): Readable & AsyncIterable<TChange>;
1415
+ stream(): Readable & AsyncIterable<TChange>;
1428
1416
  /* Excluded from this release type: _setIsEmitter */
1429
1417
  /* Excluded from this release type: _setIsIterator */
1430
1418
  /* Excluded from this release type: _createChangeStreamCursor */
@@ -2106,7 +2094,7 @@ declare class ClientEncryption {
2106
2094
  * }
2107
2095
  * ```
2108
2096
  */
2109
- rewrapManyDataKey(filter: Filter<DataKey>, options: ClientEncryptionRewrapManyDataKeyProviderOptions): Promise<{
2097
+ rewrapManyDataKey(filter: Filter<DataKey>, options?: ClientEncryptionRewrapManyDataKeyProviderOptions): Promise<{
2110
2098
  bulkWriteResult?: BulkWriteResult;
2111
2099
  }>;
2112
2100
  /**
@@ -2489,36 +2477,6 @@ declare type ClientInsertResult = {
2489
2477
  insertedId: any;
2490
2478
  };
2491
2479
 
2492
- /**
2493
- * @public
2494
- * @deprecated This interface will be made internal in the next major release.
2495
- * @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.md#hello-command
2496
- */
2497
- declare interface ClientMetadata {
2498
- driver: {
2499
- name: string;
2500
- version: string;
2501
- };
2502
- os: {
2503
- type: string;
2504
- name?: NodeJS.Platform;
2505
- architecture?: string;
2506
- version?: string;
2507
- };
2508
- platform: string;
2509
- application?: {
2510
- name: string;
2511
- };
2512
- /** FaaS environment information */
2513
- env?: {
2514
- name: 'aws.lambda' | 'gcp.func' | 'azure.func' | 'vercel';
2515
- timeout_sec?: Int32;
2516
- memory_mb?: Int32;
2517
- region?: string;
2518
- url?: string;
2519
- };
2520
- }
2521
-
2522
2480
  /** @public */
2523
2481
  declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
2524
2482
  name: 'replaceOne';
@@ -2545,7 +2503,7 @@ declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
2545
2503
  * NOTE: not meant to be instantiated directly.
2546
2504
  * @public
2547
2505
  */
2548
- declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable_2 {
2506
+ declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable {
2549
2507
  /* Excluded from this release type: client */
2550
2508
  /* Excluded from this release type: sessionPool */
2551
2509
  hasEnded: boolean;
@@ -2558,8 +2516,7 @@ declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> imple
2558
2516
  explicit: boolean;
2559
2517
  /* Excluded from this release type: owner */
2560
2518
  defaultTransactionOptions: TransactionOptions;
2561
- /** @deprecated - Will be made internal in the next major release */
2562
- transaction: Transaction;
2519
+ /* Excluded from this release type: transaction */
2563
2520
  /* Excluded from this release type: commitAttempted */
2564
2521
  readonly snapshotEnabled: boolean;
2565
2522
  /* Excluded from this release type: _serverSession */
@@ -2589,8 +2546,11 @@ declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> imple
2589
2546
  * @param options - Optional settings. Currently reserved for future use
2590
2547
  */
2591
2548
  endSession(options?: EndSessionOptions): Promise<void>;
2592
- /* Excluded from this release type: [Symbol.asyncDispose] */
2593
- /* Excluded from this release type: asyncDispose */
2549
+ /**
2550
+ * @experimental
2551
+ * An alias for {@link ClientSession.endSession|ClientSession.endSession()}.
2552
+ */
2553
+ [Symbol.asyncDispose](): Promise<void>;
2594
2554
  /**
2595
2555
  * Advances the operationTime for a ClientSession.
2596
2556
  *
@@ -2886,21 +2846,23 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2886
2846
  private _emitCollectionApiCall;
2887
2847
  aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
2888
2848
  explain: ExplainVerbosityLike;
2889
- }): Promise<Document_2>;
2890
- aggregate(pipeline: MQLPipeline, options?: AggregateOptions): Promise<AggregationCursor_2>;
2849
+ } & Abortable_2): Promise<Document_2>;
2850
+ aggregate(pipeline: MQLPipeline, options?: AggregateOptions & Abortable_2): Promise<AggregationCursor_2>;
2891
2851
  aggregate(...stages: MQLPipeline): Promise<AggregationCursor_2>;
2892
2852
  bulkWrite(operations: AnyBulkWriteOperation[], options?: BulkWriteOptions): Promise<BulkWriteResult_2>;
2893
2853
  count(query?: {}, options?: CountOptions): Promise<number>;
2894
- countDocuments(query?: MQLQuery, options?: CountDocumentsOptions): Promise<number>;
2854
+ countDocuments(query?: MQLQuery, options?: CountDocumentsOptions & Abortable_2): Promise<number>;
2895
2855
  deleteMany(filter: Document_2, options?: DeleteOptions): Promise<DeleteResult_2 | Document_2>;
2896
2856
  deleteOne(filter: Document_2, options?: DeleteOptions): Promise<DeleteResult_2 | Document_2>;
2897
2857
  distinct(field: string): Promise<Document_2>;
2898
2858
  distinct(field: string, query: MQLQuery): Promise<Document_2>;
2899
2859
  distinct(field: string, query: MQLQuery, options: DistinctOptions): Promise<Document_2>;
2900
2860
  estimatedDocumentCount(options?: EstimatedDocumentCountOptions): Promise<number>;
2901
- find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Promise<Cursor>;
2861
+ find(query?: MQLQuery, projection?: Document_2, options?: FindOptions & {
2862
+ explain?: ExplainVerbosityLike;
2863
+ } & Abortable_2): Promise<Cursor>;
2902
2864
  findAndModify(options: FindAndModifyMethodShellOptions): Promise<Document_2 | null>;
2903
- findOne(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Promise<MQLDocument | null>;
2865
+ findOne(query?: MQLQuery, projection?: Document_2, options?: FindOptions & Abortable_2): Promise<MQLDocument | null>;
2904
2866
  renameCollection(newName: string, dropTarget?: boolean): Promise<Document_2>;
2905
2867
  findOneAndDelete(filter: Document_2, options?: FindOneAndDeleteOptions): Promise<Document_2 | null>;
2906
2868
  findOneAndReplace(filter: Document_2, replacement: Document_2, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Promise<Document_2>;
@@ -3008,6 +2970,10 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3008
2970
  declare class Collection_2<TSchema extends Document_2 = Document_2> {
3009
2971
  /* Excluded from this release type: s */
3010
2972
  /* Excluded from this release type: client */
2973
+ /**
2974
+ * Get the database object for the collection.
2975
+ */
2976
+ readonly db: Db;
3011
2977
  /* Excluded from this release type: __constructor */
3012
2978
  /**
3013
2979
  * The name of the database this collection belongs to
@@ -3663,15 +3629,9 @@ declare interface CommandOperationOptions extends OperationOptions, WriteConcern
3663
3629
  * In server versions 4.4 and above, 'comment' can be any valid BSON type.
3664
3630
  */
3665
3631
  comment?: unknown;
3666
- /** Should retry failed writes */
3667
- retryWrites?: boolean;
3668
3632
  dbName?: string;
3669
3633
  authdb?: string;
3670
- /**
3671
- * @deprecated
3672
- * This option is deprecated and will be removed in an upcoming major version.
3673
- */
3674
- noResponse?: boolean;
3634
+ /* Excluded from this release type: rawData */
3675
3635
  }
3676
3636
 
3677
3637
  declare class CommandResult<T = unknown> extends ShellApiValueClass {
@@ -3984,9 +3944,8 @@ declare interface ConnectionOptions_2 extends SupportedNodeConnectionOptions, St
3984
3944
  tls: boolean;
3985
3945
  noDelay?: boolean;
3986
3946
  socketTimeoutMS?: number;
3987
- cancellationToken?: CancellationToken;
3988
- metadata: ClientMetadata;
3989
- /* Excluded from this release type: extendedMetadata */
3947
+ /* Excluded from this release type: cancellationToken */
3948
+ /* Excluded from this release type: metadata */
3990
3949
  /* Excluded from this release type: mongoLogger */
3991
3950
  }
3992
3951
 
@@ -4165,11 +4124,9 @@ declare interface CountOptions extends CommandOperationOptions {
4165
4124
  }
4166
4125
 
4167
4126
  /** @public */
4168
- declare interface CreateCollectionOptions extends CommandOperationOptions {
4127
+ declare interface CreateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
4169
4128
  /** Create a capped collection */
4170
4129
  capped?: boolean;
4171
- /** @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. */
4172
- autoIndexId?: boolean;
4173
4130
  /** The size of the capped collection in bytes */
4174
4131
  size?: number;
4175
4132
  /** The maximum number of documents in the capped collection */
@@ -4327,12 +4284,6 @@ declare class CursorIterationResult extends ShellApiValueClass {
4327
4284
  constructor();
4328
4285
  }
4329
4286
 
4330
- /** @public */
4331
- declare interface CursorStreamOptions {
4332
- /** A transformation method applied to each document emitted by the stream */
4333
- transform?(this: void, doc: Document_2): Document_2;
4334
- }
4335
-
4336
4287
  /**
4337
4288
  * @public
4338
4289
  * @experimental
@@ -4385,27 +4336,27 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
4385
4336
  _maybeCachedHello(): Promise<Document_2>;
4386
4337
  [asPrintable](): string;
4387
4338
  private _emitDatabaseApiCall;
4388
- _runCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4389
- _runReadCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4390
- _runAdminCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4391
- _runAdminReadCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<Document_2>;
4339
+ _runCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4340
+ _runReadCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4341
+ _runAdminCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4342
+ _runAdminReadCommand(cmd: Document_2, options?: CommandOperationOptions & Abortable_2): Promise<Document_2>;
4392
4343
  _runCursorCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<RunCommandCursor_2>;
4393
4344
  _runAdminCursorCommand(cmd: Document_2, options?: CommandOperationOptions): Promise<RunCommandCursor_2>;
4394
- _listCollections(filter: Document_2, options: ListCollectionsOptions): Promise<Document_2[]>;
4395
- _getCollectionNames(options?: ListCollectionsOptions): Promise<string[]>;
4396
- _getCollectionNamesWithTypes(options?: ListCollectionsOptions): Promise<CollectionNamesWithTypes[]>;
4345
+ _listCollections(filter: Document_2, options: ListCollectionsOptions & Abortable_2): Promise<Document_2[]>;
4346
+ _getCollectionNames(options?: ListCollectionsOptions & Abortable_2): Promise<string[]>;
4347
+ _getCollectionNamesWithTypes(options?: ListCollectionsOptions & Abortable_2): Promise<CollectionNamesWithTypes[]>;
4397
4348
  _getCollectionNamesForCompletion(): Promise<string[]>;
4398
4349
  _getLastErrorObj(w?: number | string, wTimeout?: number, j?: boolean): Promise<Document_2>;
4399
4350
  getMongo(): Mongo<M>;
4400
4351
  getName(): StringKey<M>;
4401
4352
  getCollectionNames(): Promise<StringKey<D>[]>;
4402
- getCollectionInfos(filter?: Document_2, options?: ListCollectionsOptions): Promise<Document_2[]>;
4403
- runCommand(cmd: string | Document_2, options?: RunCommandOptions): Promise<Document_2>;
4353
+ getCollectionInfos(filter?: Document_2, options?: ListCollectionsOptions & Abortable_2): Promise<Document_2[]>;
4354
+ runCommand(cmd: string | Document_2, options?: RunCommandOptions & Abortable_2): Promise<Document_2>;
4404
4355
  adminCommand(cmd: string | Document_2): Promise<Document_2>;
4405
4356
  aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
4406
4357
  explain: ExplainVerbosityLike;
4407
- }): Promise<Document_2>;
4408
- aggregate(pipeline: MQLPipeline, options?: AggregateOptions): Promise<AggregationCursor_2>;
4358
+ } & Abortable_2): Promise<Document_2>;
4359
+ aggregate(pipeline: MQLPipeline, options?: AggregateOptions & Abortable_2): Promise<AggregationCursor_2>;
4409
4360
  aggregate(...stages: MQLPipeline): Promise<AggregationCursor_2>;
4410
4361
  getSiblingDB<K extends StringKey<M>>(db: K): DatabaseWithSchema<M, M[K]>;
4411
4362
  getCollection<K extends StringKey<D>>(coll: K): CollectionWithSchema<M, D, D[K], K>;
@@ -4531,7 +4482,11 @@ declare type DataKeyEncryptionKeyOptions = {
4531
4482
  */
4532
4483
  declare class Db {
4533
4484
  /* Excluded from this release type: s */
4534
- /* Excluded from this release type: client */
4485
+ /**
4486
+ * Gets the MongoClient associated with the Db.
4487
+ * @public
4488
+ */
4489
+ readonly client: MongoClient;
4535
4490
  static SYSTEM_NAMESPACE_COLLECTION: string;
4536
4491
  static SYSTEM_INDEX_COLLECTION: string;
4537
4492
  static SYSTEM_PROFILE_COLLECTION: string;
@@ -4818,7 +4773,7 @@ declare class DBQuery extends ShellApiClass {
4818
4773
  }
4819
4774
 
4820
4775
  /** @public */
4821
- declare interface DbStatsOptions extends CommandOperationOptions {
4776
+ declare interface DbStatsOptions extends Omit<CommandOperationOptions, 'rawData'> {
4822
4777
  /** Divide the returned sizes by scale value. */
4823
4778
  scale?: number;
4824
4779
  }
@@ -4910,6 +4865,7 @@ declare interface DevtoolsConnectOptions extends MongoClientOptions {
4910
4865
  parentHandle?: string;
4911
4866
  proxy?: DevtoolsProxyOptions | AgentWithInitialize;
4912
4867
  applyProxyToOIDC?: boolean | DevtoolsProxyOptions | AgentWithInitialize;
4868
+ useSystemCA?: boolean;
4913
4869
  }
4914
4870
 
4915
4871
  declare interface DevtoolsProxyOptions {
@@ -4949,7 +4905,7 @@ declare interface DriverInfo {
4949
4905
  }
4950
4906
 
4951
4907
  /** @public */
4952
- declare interface DropCollectionOptions extends CommandOperationOptions {
4908
+ declare interface DropCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
4953
4909
  /** @experimental */
4954
4910
  encryptedFields?: Document_2;
4955
4911
  }
@@ -5033,7 +4989,9 @@ declare class Explainable extends ShellApiWithMongoClass {
5033
4989
  getCollection(): CollectionWithSchema;
5034
4990
  getVerbosity(): ExplainVerbosityLike;
5035
4991
  setVerbosity(verbosity: ExplainVerbosityLike): void;
5036
- find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Promise<ExplainableCursor_2>;
4992
+ find(query?: MQLQuery, projection?: Document_2, options?: FindOptions & {
4993
+ explain?: ExplainVerbosityLike;
4994
+ }): Promise<ExplainableCursor_2>;
5037
4995
  aggregate(pipeline: MQLPipeline, options: Document_2): Promise<Document_2>;
5038
4996
  aggregate(...stages: MQLPipeline): Promise<Document_2>;
5039
4997
  count(query?: {}, options?: CountOptions): Promise<Document_2>;
@@ -5454,14 +5412,7 @@ declare interface FindOneAndUpdateOptions extends CommandOperationOptions {
5454
5412
  }
5455
5413
 
5456
5414
  /** @public */
5457
- declare interface FindOneOptions extends FindOptions {
5458
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5459
- batchSize?: number;
5460
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5461
- limit?: number;
5462
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5463
- noCursorTimeout?: boolean;
5464
- }
5415
+ declare type FindOneOptions = Omit<FindOptions, 'batchSize' | 'limit' | 'noCursorTimeout'>;
5465
5416
 
5466
5417
  /**
5467
5418
  * A builder object that is returned from {@link BulkOperationBase#find}.
@@ -5494,9 +5445,8 @@ declare class FindOperators {
5494
5445
 
5495
5446
  /**
5496
5447
  * @public
5497
- * @typeParam TSchema - Unused schema definition, deprecated usage, only specify `FindOptions` with no generic
5498
5448
  */
5499
- declare interface FindOptions<TSchema extends Document_2 = Document_2> extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
5449
+ declare interface FindOptions extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
5500
5450
  /** Sets the limit of documents returned in the query. */
5501
5451
  limit?: number;
5502
5452
  /** Set to sort the documents coming back from the query. Array of indexes, `[['a', 1]]` etc. */
@@ -6231,7 +6181,7 @@ declare interface ListCollectionsOptions extends Omit<CommandOperationOptions, '
6231
6181
  }
6232
6182
 
6233
6183
  /** @public */
6234
- declare interface ListDatabasesOptions extends CommandOperationOptions {
6184
+ declare interface ListDatabasesOptions extends Omit<CommandOperationOptions, 'rawData'> {
6235
6185
  /** A query predicate that determines which databases are listed */
6236
6186
  filter?: Document_2;
6237
6187
  /** A flag to indicate whether the command should return just the database names, or return both database names and size information */
@@ -6264,6 +6214,7 @@ declare class ListIndexesCursor extends AbstractCursor {
6264
6214
  /** @public */
6265
6215
  declare type ListIndexesOptions = AbstractCursorOptions & {
6266
6216
  /* Excluded from this release type: omitMaxTimeMS */
6217
+ /* Excluded from this release type: rawData */
6267
6218
  };
6268
6219
 
6269
6220
  /** @public */
@@ -6433,7 +6384,7 @@ declare const MONGO_CLIENT_EVENTS: readonly ["connectionPoolCreated", "connectio
6433
6384
  * const client = new MongoClient('mongodb://localhost:27017?appName=mflix', { monitorCommands: true });
6434
6385
  * ```
6435
6386
  */
6436
- declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable_2 {
6387
+ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable {
6437
6388
  /* Excluded from this release type: s */
6438
6389
  /* Excluded from this release type: topology */
6439
6390
  /* Excluded from this release type: mongoLogger */
@@ -6442,10 +6393,16 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
6442
6393
  /**
6443
6394
  * The consolidate, parsed, transformed and merged options.
6444
6395
  */
6445
- 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'>;
6396
+ readonly options: Readonly<Omit<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo'>> & Pick<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo'> & {
6397
+ /* Excluded from this release type: metadata */
6398
+ };
6399
+ private driverInfoList;
6446
6400
  constructor(url: string, options?: MongoClientOptions);
6447
- /* Excluded from this release type: [Symbol.asyncDispose] */
6448
- /* Excluded from this release type: asyncDispose */
6401
+ /**
6402
+ * @experimental
6403
+ * An alias for {@link MongoClient.close|MongoClient.close()}.
6404
+ */
6405
+ [Symbol.asyncDispose](): Promise<void>;
6449
6406
  /**
6450
6407
  * Append metadata to the client metadata after instantiation.
6451
6408
  * @param driverInfo - Information about the application or library.
@@ -6469,20 +6426,13 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
6469
6426
  */
6470
6427
  bulkWrite<SchemaMap extends Record<string, Document_2> = Record<string, Document_2>>(models: ReadonlyArray<ClientBulkWriteModel<SchemaMap>>, options?: ClientBulkWriteOptions): Promise<ClientBulkWriteResult>;
6471
6428
  /**
6472
- * Connect to MongoDB using a url
6429
+ * An optional method to verify a handful of assumptions that are generally useful at application boot-time before using a MongoClient.
6430
+ * For detailed information about the connect process see the MongoClient.connect static method documentation.
6473
6431
  *
6474
- * @remarks
6475
- * Calling `connect` is optional since the first operation you perform will call `connect` if it's needed.
6476
- * `timeoutMS` will bound the time any operation can take before throwing a timeout error.
6477
- * However, when the operation being run is automatically connecting your `MongoClient` the `timeoutMS` will not apply to the time taken to connect the MongoClient.
6478
- * This means the time to setup the `MongoClient` does not count against `timeoutMS`.
6479
- * If you are using `timeoutMS` we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
6432
+ * @param url - The MongoDB connection string (supports `mongodb://` and `mongodb+srv://` schemes)
6433
+ * @param options - Optional configuration options for the client
6480
6434
  *
6481
- * @remarks
6482
- * The driver will look up corresponding SRV and TXT records if the connection string starts with `mongodb+srv://`.
6483
- * If those look ups throw a DNS Timeout error, the driver will retry the look up once.
6484
- *
6485
- * @see docs.mongodb.org/manual/reference/connection-string/
6435
+ * @see https://www.mongodb.com/docs/manual/reference/connection-string/
6486
6436
  */
6487
6437
  connect(): Promise<this>;
6488
6438
  /* Excluded from this release type: _connect */
@@ -6541,21 +6491,35 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
6541
6491
  */
6542
6492
  db(dbName?: string, options?: DbOptions): Db;
6543
6493
  /**
6544
- * Connect to MongoDB using a url
6494
+ * Creates a new MongoClient instance and immediately connects it to MongoDB.
6495
+ * This convenience method combines `new MongoClient(url, options)` and `client.connect()` in a single step.
6496
+ *
6497
+ * Connect can be helpful to detect configuration issues early by validating:
6498
+ * - **DNS Resolution**: Verifies that SRV records and hostnames in the connection string resolve DNS entries
6499
+ * - **Network Connectivity**: Confirms that host addresses are reachable and ports are open
6500
+ * - **TLS Configuration**: Validates SSL/TLS certificates, CA files, and encryption settings are correct
6501
+ * - **Authentication**: Verifies that provided credentials are valid
6502
+ * - **Server Compatibility**: Ensures the MongoDB server version is supported by this driver version
6503
+ * - **Load Balancer Setup**: For load-balanced deployments, confirms the service is properly configured
6504
+ *
6505
+ * @returns A promise that resolves to the same MongoClient instance once connected
6545
6506
  *
6546
6507
  * @remarks
6547
- * Calling `connect` is optional since the first operation you perform will call `connect` if it's needed.
6548
- * `timeoutMS` will bound the time any operation can take before throwing a timeout error.
6549
- * However, when the operation being run is automatically connecting your `MongoClient` the `timeoutMS` will not apply to the time taken to connect the MongoClient.
6550
- * This means the time to setup the `MongoClient` does not count against `timeoutMS`.
6551
- * If you are using `timeoutMS` we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
6508
+ * **Connection is Optional:** Calling `connect` is optional since any operation method (`find`, `insertOne`, etc.)
6509
+ * will automatically perform these same validation steps if the client is not already connected.
6510
+ * However, explicitly calling `connect` can make sense for:
6511
+ * - **Fail-fast Error Detection**: Non-transient connection issues (hostname unresolved, port refused connection) are discovered immediately rather than during your first operation
6512
+ * - **Predictable Performance**: Eliminates first connection overhead from your first database operation
6552
6513
  *
6553
6514
  * @remarks
6554
- * The programmatically provided options take precedence over the URI options.
6515
+ * **Connection Pooling Impact:** Calling `connect` will populate the connection pool with one connection
6516
+ * to a server selected by the client's configured `readPreference` (defaults to primary).
6555
6517
  *
6556
6518
  * @remarks
6557
- * The driver will look up corresponding SRV and TXT records if the connection string starts with `mongodb+srv://`.
6558
- * If those look ups throw a DNS Timeout error, the driver will retry the look up once.
6519
+ * **Timeout Behavior:** When using `timeoutMS`, the connection establishment time does not count against
6520
+ * the timeout for subsequent operations. This means `connect` runs without a `timeoutMS` limit, while
6521
+ * your database operations will still respect the configured timeout. If you need predictable operation
6522
+ * timing with `timeoutMS`, call `connect` explicitly before performing operations.
6559
6523
  *
6560
6524
  * @see https://www.mongodb.com/docs/manual/reference/connection-string/
6561
6525
  */
@@ -6800,7 +6764,10 @@ declare interface MongoClientOptions extends BSONSerializeOptions, SupportedNode
6800
6764
  * 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.
6801
6765
  */
6802
6766
  autoEncryption?: AutoEncryptionOptions;
6803
- /** Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver */
6767
+ /**
6768
+ * Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver
6769
+ /* @deprecated - Will be made internal in a future major release.
6770
+ */
6804
6771
  driverInfo?: DriverInfo;
6805
6772
  /** Configures a Socks5 proxy host used for creating TCP connections. */
6806
6773
  proxyHost?: string;
@@ -7342,10 +7309,7 @@ declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEn
7342
7309
  compressors: CompressorName[];
7343
7310
  writeConcern: WriteConcern;
7344
7311
  dbName: string;
7345
- /** @deprecated - Will be made internal in a future major release. */
7346
- metadata: ClientMetadata;
7347
- extendedMetadata: Promise<Document_2>;
7348
- additionalDriverInfo: DriverInfo[];
7312
+ /* Excluded from this release type: metadata */
7349
7313
  /* Excluded from this release type: autoEncrypter */
7350
7314
  /* Excluded from this release type: tokenCache */
7351
7315
  proxyHost?: string;
@@ -7685,7 +7649,7 @@ declare const ProfilingLevel: Readonly<{
7685
7649
  declare type ProfilingLevel = (typeof ProfilingLevel)[keyof typeof ProfilingLevel];
7686
7650
 
7687
7651
  /** @public */
7688
- declare type ProfilingLevelOptions = CommandOperationOptions;
7652
+ declare type ProfilingLevelOptions = Omit<CommandOperationOptions, 'rawData'>;
7689
7653
 
7690
7654
  declare type ProxyEventArgs<K extends keyof ProxyEventMap> = ProxyEventMap[K] extends (...args: infer P) => any ? P : never;
7691
7655
 
@@ -7789,16 +7753,16 @@ declare interface RangeOptions {
7789
7753
  }
7790
7754
 
7791
7755
  declare interface Readable_2 {
7792
- aggregate(database: string, collection: string, pipeline: Document_2[], options?: AggregateOptions, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
7793
- aggregateDb(database: string, pipeline: Document_2[], options?: AggregateOptions, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
7756
+ aggregate(database: string, collection: string, pipeline: Document_2[], options?: AggregateOptions & Abortable_2, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
7757
+ aggregateDb(database: string, pipeline: Document_2[], options?: AggregateOptions & Abortable_2, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
7794
7758
  count(db: string, coll: string, query?: Document_2, options?: CountOptions, dbOptions?: DbOptions): Promise<number>;
7795
- countDocuments(database: string, collection: string, filter?: Document_2, options?: CountDocumentsOptions, dbOptions?: DbOptions): Promise<number>;
7759
+ countDocuments(database: string, collection: string, filter?: Document_2, options?: CountDocumentsOptions & Abortable_2, dbOptions?: DbOptions): Promise<number>;
7796
7760
  distinct(database: string, collection: string, fieldName: string, filter?: Document_2, options?: DistinctOptions, dbOptions?: DbOptions): Promise<Document_2>;
7797
7761
  estimatedDocumentCount(database: string, collection: string, options?: EstimatedDocumentCountOptions, dbOptions?: DbOptions): Promise<number>;
7798
- find(database: string, collection: string, filter?: Document_2, options?: FindOptions, dbOptions?: DbOptions): ServiceProviderFindCursor;
7762
+ find(database: string, collection: string, filter?: Document_2, options?: FindOptions & Abortable_2, dbOptions?: DbOptions): ServiceProviderFindCursor;
7799
7763
  getTopologyDescription(): TopologyDescription_2 | undefined;
7800
7764
  getIndexes(database: string, collection: string, options: ListIndexesOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
7801
- listCollections(database: string, filter?: Document_2, options?: ListCollectionsOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
7765
+ listCollections(database: string, filter?: Document_2, options?: ListCollectionsOptions & Abortable_2, dbOptions?: DbOptions): Promise<Document_2[]>;
7802
7766
  readPreferenceFromOptions(options?: Omit<ReadPreferenceFromOptions, 'session'>): ReadPreferenceLike | undefined;
7803
7767
  watch(pipeline: Document_2[], options: ChangeStreamOptions, dbOptions?: DbOptions, db?: string, coll?: string): ServiceProviderChangeStream;
7804
7768
  getSearchIndexes(database: string, collection: string, indexName?: string, options?: Document_2, dbOptions?: DbOptions): Promise<Document_2[]>;
@@ -7860,7 +7824,6 @@ declare class ReadPreference {
7860
7824
  tags?: TagSet[];
7861
7825
  hedge?: HedgeOptions;
7862
7826
  maxStalenessSeconds?: number;
7863
- minWireVersion?: number;
7864
7827
  static PRIMARY: "primary";
7865
7828
  static PRIMARY_PREFERRED: "primaryPreferred";
7866
7829
  static SECONDARY: "secondary";
@@ -7992,13 +7955,18 @@ declare type RemoveShellOptions = DeleteOptions & {
7992
7955
  };
7993
7956
 
7994
7957
  /** @public */
7995
- declare type RemoveUserOptions = CommandOperationOptions;
7958
+ declare type RemoveUserOptions = Omit<CommandOperationOptions, 'rawData'>;
7996
7959
 
7997
7960
  /** @public */
7998
- declare interface RenameOptions extends CommandOperationOptions {
7961
+ declare interface RenameOptions extends Omit<CommandOperationOptions, 'rawData'> {
7999
7962
  /** Drop the target name collection if it previously exists. */
8000
7963
  dropTarget?: boolean;
8001
- /** Unclear */
7964
+ /**
7965
+ * @deprecated
7966
+ *
7967
+ * This option has been dead code since at least Node driver version 4.x. It will
7968
+ * be removed in a future major release.
7969
+ */
8002
7970
  new_collection?: boolean;
8003
7971
  }
8004
7972
 
@@ -8565,7 +8533,7 @@ declare type SetFields<TSchema> = ({
8565
8533
  };
8566
8534
 
8567
8535
  /** @public */
8568
- declare type SetProfilingLevelOptions = CommandOperationOptions;
8536
+ declare type SetProfilingLevelOptions = Omit<CommandOperationOptions, 'rawData'>;
8569
8537
 
8570
8538
  /**
8571
8539
  * @public
@@ -9206,40 +9174,6 @@ declare interface TopologyVersion {
9206
9174
  counter: Long;
9207
9175
  }
9208
9176
 
9209
- /**
9210
- * @public
9211
- * @deprecated - Will be made internal in a future major release.
9212
- * A class maintaining state related to a server transaction. Internal Only
9213
- */
9214
- declare class Transaction {
9215
- /* Excluded from this release type: state */
9216
- /** @deprecated - Will be made internal in a future major release. */
9217
- options: TransactionOptions;
9218
- /* Excluded from this release type: _pinnedServer */
9219
- /* Excluded from this release type: _recoveryToken */
9220
- /* Excluded from this release type: __constructor */
9221
- /* Excluded from this release type: server */
9222
- /** @deprecated - Will be made internal in a future major release. */
9223
- get recoveryToken(): Document_2 | undefined;
9224
- /** @deprecated - Will be made internal in a future major release. */
9225
- get isPinned(): boolean;
9226
- /**
9227
- * @deprecated - Will be made internal in a future major release.
9228
- * @returns Whether the transaction has started
9229
- */
9230
- get isStarting(): boolean;
9231
- /**
9232
- * @deprecated - Will be made internal in a future major release.
9233
- * @returns Whether this session is presently in a transaction
9234
- */
9235
- get isActive(): boolean;
9236
- /** @deprecated - Will be made internal in a future major release. */
9237
- get isCommitted(): boolean;
9238
- /* Excluded from this release type: transition */
9239
- /* Excluded from this release type: pinServer */
9240
- /* Excluded from this release type: unpinServer */
9241
- }
9242
-
9243
9177
  /**
9244
9178
  * Configuration options for a transaction.
9245
9179
  * @public
@@ -9501,7 +9435,7 @@ declare interface UseEvent {
9501
9435
  }
9502
9436
 
9503
9437
  /** @public */
9504
- declare interface ValidateCollectionOptions extends CommandOperationOptions {
9438
+ declare interface ValidateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
9505
9439
  /** Validates a collection in the background, without interrupting read or write traffic (only in MongoDB 4.4+) */
9506
9440
  background?: boolean;
9507
9441
  }
@@ -9529,8 +9463,8 @@ declare type WorkspaceDefaults = {
9529
9463
  };
9530
9464
 
9531
9465
  declare interface Writable {
9532
- runCommand(db: string, spec: Document_2, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document_2>;
9533
- runCommandWithCheck(db: string, spec: Document_2, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document_2>;
9466
+ runCommand(db: string, spec: Document_2, options: RunCommandOptions & Abortable_2, dbOptions?: DbOptions): Promise<Document_2>;
9467
+ runCommandWithCheck(db: string, spec: Document_2, options: RunCommandOptions & Abortable_2, dbOptions?: DbOptions): Promise<Document_2>;
9534
9468
  runCursorCommand(db: string, spec: Document_2, options: RunCursorCommandOptions, dbOptions?: DbOptions): ServiceProviderRunCommandCursor;
9535
9469
  dropDatabase(database: string, options: DropDatabaseOptions, dbOptions?: DbOptions): Promise<Document_2>;
9536
9470
  bulkWrite(database: string, collection: string, requests: AnyBulkWriteOperation[], options: BulkWriteOptions, dbOptions?: DbOptions): Promise<BulkWriteResult>;