@mongosh/shell-api 3.18.0 → 3.22.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.
package/lib/api-raw.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import type { Agent } from 'https';
4
+ import type { AgentConnectOpts } from 'agent-base';
4
5
  import { Binary } from 'bson';
5
6
  import { BSONRegExp } from 'bson';
6
7
  import { BSONSymbol } from 'bson';
@@ -26,6 +27,7 @@ import { ObjectId } from 'bson';
26
27
  import type { ObjectIdLike } from 'bson';
27
28
  import { Readable } from 'stream';
28
29
  import type { RequestOptions } from 'https';
30
+ import type { SecureContextOptions } from 'tls';
29
31
  import type { SerializeOptions } from 'bson';
30
32
  import type { ServerResponse } from 'http';
31
33
  import type { SrvRecord } from 'dns';
@@ -879,6 +881,10 @@ declare interface AutoEncryptionOptions {
879
881
  bypassAutoEncryption?: boolean;
880
882
  /** Allows users to bypass query analysis */
881
883
  bypassQueryAnalysis?: boolean;
884
+ /**
885
+ * Sets the expiration time for the DEK in the cache in milliseconds. Defaults to 60000. 0 means no timeout.
886
+ */
887
+ keyExpirationMS?: number;
882
888
  options?: {
883
889
  /** An optional hook to catch logging messages from the underlying encryption engine */
884
890
  logger?: (level: AutoEncryptionLoggerLevel, message: string) => void;
@@ -1165,10 +1171,10 @@ declare class BulkFindOp extends ShellApiWithMongoClass {
1165
1171
 
1166
1172
  /** @public */
1167
1173
  declare abstract class BulkOperationBase {
1168
- private collection;
1169
1174
  isOrdered: boolean;
1170
1175
  /* Excluded from this release type: s */
1171
1176
  operationId?: number;
1177
+ private collection;
1172
1178
  /* Excluded from this release type: __constructor */
1173
1179
  /**
1174
1180
  * Add a single insert document to the bulk operation
@@ -1301,7 +1307,7 @@ declare class BulkWriteResult {
1301
1307
  getRawResponse(): Document_2;
1302
1308
  /** Returns true if the bulk operation contains a write error */
1303
1309
  hasWriteErrors(): boolean;
1304
- /** Returns the number of write errors off the bulk operation */
1310
+ /** Returns the number of write errors from the bulk operation */
1305
1311
  getWriteErrorCount(): number;
1306
1312
  /** Returns a specific write error object */
1307
1313
  getWriteErrorAt(index: number): WriteError | undefined;
@@ -1339,7 +1345,10 @@ declare type CacheOptions = {
1339
1345
  aggregationSchemaTTL: number;
1340
1346
  };
1341
1347
 
1342
- /** @public */
1348
+ /**
1349
+ * @public
1350
+ * @deprecated Will be removed in favor of `AbortSignal` in the next major release.
1351
+ */
1343
1352
  declare class CancellationToken extends TypedEventEmitter<{
1344
1353
  cancel(): void;
1345
1354
  }> {
@@ -1447,7 +1456,7 @@ declare class ChangeStream<TSchema extends Document_2 = Document_2, TChange exte
1447
1456
  * @public
1448
1457
  * @see https://www.mongodb.com/docs/manual/reference/change-events/modify/#mongodb-data-modify
1449
1458
  */
1450
- declare interface ChangeStreamCollModDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
1459
+ declare interface ChangeStreamCollModDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
1451
1460
  /** Describes the type of operation represented in this change notification */
1452
1461
  operationType: 'modify';
1453
1462
  }
@@ -1456,7 +1465,7 @@ declare interface ChangeStreamCollModDocument extends ChangeStreamDocumentCommon
1456
1465
  * @public
1457
1466
  * @see https://www.mongodb.com/docs/manual/reference/change-events/create/#mongodb-data-create
1458
1467
  */
1459
- declare interface ChangeStreamCreateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
1468
+ declare interface ChangeStreamCreateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
1460
1469
  /** Describes the type of operation represented in this change notification */
1461
1470
  operationType: 'create';
1462
1471
  /**
@@ -1472,7 +1481,7 @@ declare interface ChangeStreamCreateDocument extends ChangeStreamDocumentCommon,
1472
1481
  * @public
1473
1482
  * @see https://www.mongodb.com/docs/manual/reference/change-events/createIndexes/#mongodb-data-createIndexes
1474
1483
  */
1475
- declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
1484
+ declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
1476
1485
  /** Describes the type of operation represented in this change notification */
1477
1486
  operationType: 'createIndexes';
1478
1487
  }
@@ -1505,7 +1514,7 @@ declare class ChangeStreamCursor extends ShellApiWithMongoClass {
1505
1514
  * @public
1506
1515
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#delete-event
1507
1516
  */
1508
- declare interface ChangeStreamDeleteDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
1517
+ declare interface ChangeStreamDeleteDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
1509
1518
  /** Describes the type of operation represented in this change notification */
1510
1519
  operationType: 'delete';
1511
1520
  /** Namespace the delete event occurred on */
@@ -1598,11 +1607,21 @@ declare interface ChangeStreamDocumentOperationDescription {
1598
1607
  operationDescription?: Document_2;
1599
1608
  }
1600
1609
 
1610
+ /** @public */
1611
+ declare interface ChangeStreamDocumentWallTime {
1612
+ /**
1613
+ * The server date and time of the database operation.
1614
+ * wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event.
1615
+ * @sinceServerVersion 6.0.0
1616
+ */
1617
+ wallTime?: Date;
1618
+ }
1619
+
1601
1620
  /**
1602
1621
  * @public
1603
1622
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#dropdatabase-event
1604
1623
  */
1605
- declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCommon {
1624
+ declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentWallTime {
1606
1625
  /** Describes the type of operation represented in this change notification */
1607
1626
  operationType: 'dropDatabase';
1608
1627
  /** The database dropped */
@@ -1615,7 +1634,7 @@ declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentC
1615
1634
  * @public
1616
1635
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#drop-event
1617
1636
  */
1618
- declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
1637
+ declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
1619
1638
  /** Describes the type of operation represented in this change notification */
1620
1639
  operationType: 'drop';
1621
1640
  /** Namespace the drop event occurred on */
@@ -1627,7 +1646,7 @@ declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCommon, C
1627
1646
  * @public
1628
1647
  * @see https://www.mongodb.com/docs/manual/reference/change-events/dropIndexes/#mongodb-data-dropIndexes
1629
1648
  */
1630
- declare interface ChangeStreamDropIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
1649
+ declare interface ChangeStreamDropIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
1631
1650
  /** Describes the type of operation represented in this change notification */
1632
1651
  operationType: 'dropIndexes';
1633
1652
  }
@@ -1654,7 +1673,7 @@ declare type ChangeStreamEvents<TSchema extends Document_2 = Document_2, TChange
1654
1673
  * @public
1655
1674
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#insert-event
1656
1675
  */
1657
- declare interface ChangeStreamInsertDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
1676
+ declare interface ChangeStreamInsertDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
1658
1677
  /** Describes the type of operation represented in this change notification */
1659
1678
  operationType: 'insert';
1660
1679
  /** This key will contain the document being inserted */
@@ -1667,7 +1686,7 @@ declare interface ChangeStreamInsertDocument<TSchema extends Document_2 = Docume
1667
1686
  * @public
1668
1687
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#invalidate-event
1669
1688
  */
1670
- declare interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentCommon {
1689
+ declare interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentWallTime {
1671
1690
  /** Describes the type of operation represented in this change notification */
1672
1691
  operationType: 'invalidate';
1673
1692
  }
@@ -1758,7 +1777,7 @@ declare interface ChangeStreamRefineCollectionShardKeyDocument extends ChangeStr
1758
1777
  * @public
1759
1778
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#rename-event
1760
1779
  */
1761
- declare interface ChangeStreamRenameDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
1780
+ declare interface ChangeStreamRenameDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
1762
1781
  /** Describes the type of operation represented in this change notification */
1763
1782
  operationType: 'rename';
1764
1783
  /** The new name for the `ns.coll` collection */
@@ -1774,7 +1793,7 @@ declare interface ChangeStreamRenameDocument extends ChangeStreamDocumentCommon,
1774
1793
  * @public
1775
1794
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#replace-event
1776
1795
  */
1777
- declare interface ChangeStreamReplaceDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema> {
1796
+ declare interface ChangeStreamReplaceDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentWallTime {
1778
1797
  /** Describes the type of operation represented in this change notification */
1779
1798
  operationType: 'replace';
1780
1799
  /** The fullDocument of a replace event represents the document after the insert of the replacement document */
@@ -1804,7 +1823,7 @@ declare interface ChangeStreamReshardCollectionDocument extends ChangeStreamDocu
1804
1823
  * @public
1805
1824
  * @see https://www.mongodb.com/docs/manual/reference/change-events/shardCollection/#mongodb-data-shardCollection
1806
1825
  */
1807
- declare interface ChangeStreamShardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
1826
+ declare interface ChangeStreamShardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
1808
1827
  /** Describes the type of operation represented in this change notification */
1809
1828
  operationType: 'shardCollection';
1810
1829
  }
@@ -1821,7 +1840,7 @@ declare interface ChangeStreamSplitEvent {
1821
1840
  * @public
1822
1841
  * @see https://www.mongodb.com/docs/manual/reference/change-events/#update-event
1823
1842
  */
1824
- declare interface ChangeStreamUpdateDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
1843
+ declare interface ChangeStreamUpdateDocument<TSchema extends Document_2 = Document_2> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
1825
1844
  /** Describes the type of operation represented in this change notification */
1826
1845
  operationType: 'update';
1827
1846
  /**
@@ -2357,7 +2376,7 @@ declare interface ClientEncryptionEncryptOptions {
2357
2376
  /**
2358
2377
  * The algorithm to use for encryption.
2359
2378
  */
2360
- algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'Range';
2379
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'Range' | 'TextPreview';
2361
2380
  /**
2362
2381
  * The id of the Binary dataKey to use for encryption
2363
2382
  */
@@ -2371,9 +2390,15 @@ declare interface ClientEncryptionEncryptOptions {
2371
2390
  /**
2372
2391
  * The query type.
2373
2392
  */
2374
- queryType?: 'equality' | 'range';
2393
+ queryType?: 'equality' | 'range' | 'prefixPreview' | 'suffixPreview' | 'substringPreview';
2375
2394
  /** The index options for a Queryable Encryption field supporting "range" queries.*/
2376
2395
  rangeOptions?: RangeOptions;
2396
+ /**
2397
+ * Options for a Queryable Encryption field supporting text queries. Only valid when `algorithm` is `TextPreview`.
2398
+ *
2399
+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
2400
+ */
2401
+ textOptions?: TextQueryOptions;
2377
2402
  }
2378
2403
 
2379
2404
  /**
@@ -2405,6 +2430,10 @@ declare interface ClientEncryptionOptions {
2405
2430
  * TLS options for kms providers to use.
2406
2431
  */
2407
2432
  tlsOptions?: CSFLEKMSTlsOptions;
2433
+ /**
2434
+ * Sets the expiration time for the DEK in the cache in milliseconds. Defaults to 60000. 0 means no timeout.
2435
+ */
2436
+ keyExpirationMS?: number;
2408
2437
  /**
2409
2438
  * @experimental
2410
2439
  *
@@ -2460,7 +2489,7 @@ declare interface ClientEncryptionRewrapManyDataKeyProviderOptions {
2460
2489
  *
2461
2490
  * These options are not included in the type, and are ignored if provided.
2462
2491
  */
2463
- declare type ClientEncryptionTlsOptions = Pick<MongoClientOptions, 'tlsCAFile' | 'tlsCertificateKeyFile' | 'tlsCertificateKeyFilePassword'>;
2492
+ declare type ClientEncryptionTlsOptions = Pick<MongoClientOptions, 'tlsCAFile' | 'tlsCertificateKeyFile' | 'tlsCertificateKeyFilePassword' | 'secureContext'>;
2464
2493
 
2465
2494
  /** @public */
2466
2495
  declare interface ClientInsertOneModel<TSchema> extends ClientWriteModel {
@@ -2483,6 +2512,7 @@ declare type ClientInsertResult = {
2483
2512
 
2484
2513
  /**
2485
2514
  * @public
2515
+ * @deprecated This interface will be made internal in the next major release.
2486
2516
  * @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.md#hello-command
2487
2517
  */
2488
2518
  declare interface ClientMetadata {
@@ -2526,6 +2556,8 @@ declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
2526
2556
  hint?: Hint;
2527
2557
  /** When true, creates a new document if no document matches the query. */
2528
2558
  upsert?: boolean;
2559
+ /** Specifies the sort order for the documents matched by the filter. */
2560
+ sort?: Sort;
2529
2561
  }
2530
2562
 
2531
2563
  /**
@@ -2547,6 +2579,7 @@ declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> imple
2547
2579
  explicit: boolean;
2548
2580
  /* Excluded from this release type: owner */
2549
2581
  defaultTransactionOptions: TransactionOptions;
2582
+ /** @deprecated - Will be made internal in the next major release */
2550
2583
  transaction: Transaction;
2551
2584
  /* Excluded from this release type: commitAttempted */
2552
2585
  readonly snapshotEnabled: boolean;
@@ -2772,6 +2805,8 @@ declare interface ClientUpdateOneModel<TSchema> extends ClientWriteModel {
2772
2805
  hint?: Hint;
2773
2806
  /** When true, creates a new document if no document matches the query. */
2774
2807
  upsert?: boolean;
2808
+ /** Specifies the sort order for the documents matched by the filter. */
2809
+ sort?: Sort;
2775
2810
  }
2776
2811
 
2777
2812
  /** @public */
@@ -2819,7 +2854,7 @@ declare interface ClientWriteModel {
2819
2854
  }
2820
2855
 
2821
2856
  declare interface Closable {
2822
- close(force: boolean): Promise<void>;
2857
+ close(): Promise<void>;
2823
2858
  suspend(): Promise<() => Promise<void>>;
2824
2859
  }
2825
2860
 
@@ -2901,7 +2936,9 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2901
2936
  multi?: boolean;
2902
2937
  }): Promise<UpdateResult_2 | Document_2>;
2903
2938
  updateMany(filter: Document_2, update: Document_2, options?: UpdateOptions): Promise<UpdateResult_2 | Document_2>;
2904
- updateOne(filter: Document_2, update: Document_2, options?: UpdateOptions): Promise<UpdateResult_2 | Document_2>;
2939
+ updateOne(filter: Document_2, update: Document_2, options?: UpdateOptions & {
2940
+ sort?: Document_2;
2941
+ }): Promise<UpdateResult_2 | Document_2>;
2905
2942
  compactStructuredEncryptionData(): Promise<Document_2>;
2906
2943
  convertToCapped(size: number): Promise<Document_2>;
2907
2944
  _createIndexes(keyPatterns: Document_2[], options?: CreateIndexesOptions, commitQuorum?: number | string): Promise<string[]>;
@@ -3075,7 +3112,9 @@ declare class Collection_2<TSchema extends Document_2 = Document_2> {
3075
3112
  * @param update - The modifications to apply
3076
3113
  * @param options - Optional settings for the command
3077
3114
  */
3078
- updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Document_2[], options?: UpdateOptions): Promise<UpdateResult<TSchema>>;
3115
+ updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Document_2[], options?: UpdateOptions & {
3116
+ sort?: Sort;
3117
+ }): Promise<UpdateResult<TSchema>>;
3079
3118
  /**
3080
3119
  * Replace a document in a collection with another document
3081
3120
  *
@@ -3134,10 +3173,10 @@ declare class Collection_2<TSchema extends Document_2 = Document_2> {
3134
3173
  */
3135
3174
  findOne(): Promise<WithId<TSchema> | null>;
3136
3175
  findOne(filter: Filter<TSchema>): Promise<WithId<TSchema> | null>;
3137
- findOne(filter: Filter<TSchema>, options: Omit<FindOptions, 'timeoutMode'> & Abortable): Promise<WithId<TSchema> | null>;
3176
+ findOne(filter: Filter<TSchema>, options: Omit<FindOneOptions, 'timeoutMode'> & Abortable): Promise<WithId<TSchema> | null>;
3138
3177
  findOne<T = TSchema>(): Promise<T | null>;
3139
3178
  findOne<T = TSchema>(filter: Filter<TSchema>): Promise<T | null>;
3140
- findOne<T = TSchema>(filter: Filter<TSchema>, options?: Omit<FindOptions, 'timeoutMode'> & Abortable): Promise<T | null>;
3179
+ findOne<T = TSchema>(filter: Filter<TSchema>, options?: Omit<FindOneOptions, 'timeoutMode'> & Abortable): Promise<T | null>;
3141
3180
  /**
3142
3181
  * Creates a cursor for a filter that can be used to iterate over results from MongoDB
3143
3182
  *
@@ -3311,6 +3350,9 @@ declare class Collection_2<TSchema extends Document_2 = Document_2> {
3311
3350
  distinct<Key extends keyof WithId<TSchema>>(key: Key): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
3312
3351
  distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
3313
3352
  distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>, options: DistinctOptions): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
3353
+ distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>, options: DistinctOptions & {
3354
+ explain: ExplainVerbosityLike | ExplainCommandOptions;
3355
+ }): Promise<Document_2>;
3314
3356
  distinct(key: string): Promise<any[]>;
3315
3357
  distinct(key: string, filter: Filter<TSchema>): Promise<any[]>;
3316
3358
  distinct(key: string, filter: Filter<TSchema>, options: DistinctOptions): Promise<any[]>;
@@ -3617,6 +3659,7 @@ declare class CommandFailedEvent {
3617
3659
  commandName: string;
3618
3660
  failure: Error;
3619
3661
  serviceId?: ObjectId;
3662
+ databaseName: string;
3620
3663
  /* Excluded from this release type: name */
3621
3664
  /* Excluded from this release type: __constructor */
3622
3665
  get hasServiceId(): boolean;
@@ -3645,6 +3688,10 @@ declare interface CommandOperationOptions extends OperationOptions, WriteConcern
3645
3688
  retryWrites?: boolean;
3646
3689
  dbName?: string;
3647
3690
  authdb?: string;
3691
+ /**
3692
+ * @deprecated
3693
+ * This option is deprecated and will be removed in an upcoming major version.
3694
+ */
3648
3695
  noResponse?: boolean;
3649
3696
  }
3650
3697
 
@@ -3701,6 +3748,7 @@ declare class CommandSucceededEvent {
3701
3748
  commandName: string;
3702
3749
  reply: unknown;
3703
3750
  serviceId?: ObjectId;
3751
+ databaseName: string;
3704
3752
  /* Excluded from this release type: name */
3705
3753
  /* Excluded from this release type: __constructor */
3706
3754
  get hasServiceId(): boolean;
@@ -4870,7 +4918,7 @@ declare class DevtoolsConnectionState {
4870
4918
  productName: string;
4871
4919
  private stateShareClient;
4872
4920
  private stateShareServer;
4873
- constructor(options: Pick<DevtoolsConnectOptions, 'productDocsLink' | 'productName' | 'oidc' | 'parentHandle'>, logger: ConnectLogEmitter, ca: string | undefined);
4921
+ constructor(options: Pick<DevtoolsConnectOptions, 'productDocsLink' | 'productName' | 'oidc' | 'parentHandle'>, logger: ConnectLogEmitter);
4874
4922
  getStateShareServer(): Promise<string>;
4875
4923
  destroy(): Promise<void>;
4876
4924
  }
@@ -4882,7 +4930,7 @@ declare interface DevtoolsConnectOptions extends MongoClientOptions {
4882
4930
  parentState?: DevtoolsConnectionState;
4883
4931
  parentHandle?: string;
4884
4932
  proxy?: DevtoolsProxyOptions | AgentWithInitialize;
4885
- applyProxyToOIDC?: boolean;
4933
+ applyProxyToOIDC?: boolean | DevtoolsProxyOptions | AgentWithInitialize;
4886
4934
  }
4887
4935
 
4888
4936
  declare interface DevtoolsProxyOptions {
@@ -4894,6 +4942,7 @@ declare interface DevtoolsProxyOptions {
4894
4942
  identityKeyPassphrase?: string;
4895
4943
  };
4896
4944
  ca?: ConnectionOptions['ca'];
4945
+ caExcludeSystemCerts?: boolean;
4897
4946
  env?: Record<string, string | undefined>;
4898
4947
  }
4899
4948
 
@@ -5425,6 +5474,16 @@ declare interface FindOneAndUpdateOptions extends CommandOperationOptions {
5425
5474
  includeResultMetadata?: boolean;
5426
5475
  }
5427
5476
 
5477
+ /** @public */
5478
+ declare interface FindOneOptions extends FindOptions {
5479
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5480
+ batchSize?: number;
5481
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5482
+ limit?: number;
5483
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5484
+ noCursorTimeout?: boolean;
5485
+ }
5486
+
5428
5487
  /**
5429
5488
  * A builder object that is returned from {@link BulkOperationBase#find}.
5430
5489
  * Is used to build a write operation that involves a query filter.
@@ -5680,7 +5739,10 @@ declare type HostInformation = {
5680
5739
  is_do_url?: boolean;
5681
5740
  };
5682
5741
 
5683
- /** @public */
5742
+ /**
5743
+ * @public
5744
+ * @deprecated Use a custom `fetch` function instead
5745
+ */
5684
5746
  declare type HttpOptions = Partial<Pick<RequestOptions, 'agent' | 'ca' | 'cert' | 'crl' | 'headers' | 'key' | 'lookup' | 'passphrase' | 'pfx' | 'timeout'>>;
5685
5747
 
5686
5748
  /**
@@ -6186,7 +6248,7 @@ declare interface KMSProviders {
6186
6248
  }
6187
6249
 
6188
6250
  /** @public */
6189
- declare const LEGAL_TCP_SOCKET_OPTIONS: readonly ["autoSelectFamily", "autoSelectFamilyAttemptTimeout", "family", "hints", "localAddress", "localPort", "lookup"];
6251
+ declare const LEGAL_TCP_SOCKET_OPTIONS: readonly ["autoSelectFamily", "autoSelectFamilyAttemptTimeout", "keepAliveInitialDelay", "family", "hints", "localAddress", "localPort", "lookup"];
6190
6252
 
6191
6253
  /** @public */
6192
6254
  declare const LEGAL_TLS_SOCKET_OPTIONS: readonly ["allowPartialTrustChain", "ALPNProtocols", "ca", "cert", "checkServerIdentity", "ciphers", "crl", "ecdhCurve", "key", "minDHSize", "passphrase", "pfx", "rejectUnauthorized", "secureContext", "secureProtocol", "servername", "session"];
@@ -6358,7 +6420,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
6358
6420
  bulkWrite(models: AnyClientBulkWriteModel<Document_2>[], options?: ClientBulkWriteOptions): Promise<ClientBulkWriteResult_2>;
6359
6421
  getDBNames(options?: ListDatabasesOptions): Promise<StringKey<M>[]>;
6360
6422
  show(cmd: string, arg?: string, tracked?: boolean): Promise<CommandResult>;
6361
- close(force?: boolean): Promise<void>;
6423
+ close(): Promise<void>;
6362
6424
  _suspend(): Promise<() => Promise<void>>;
6363
6425
  getReadPrefMode(): ReadPreferenceMode;
6364
6426
  getReadPrefTagSet(): Record<string, string>[] | undefined;
@@ -6387,22 +6449,35 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
6387
6449
  declare const MONGO_CLIENT_EVENTS: readonly ["connectionPoolCreated", "connectionPoolReady", "connectionPoolCleared", "connectionPoolClosed", "connectionCreated", "connectionReady", "connectionClosed", "connectionCheckOutStarted", "connectionCheckOutFailed", "connectionCheckedOut", "connectionCheckedIn", "commandStarted", "commandSucceeded", "commandFailed", "serverOpening", "serverClosed", "serverDescriptionChanged", "topologyOpening", "topologyClosed", "topologyDescriptionChanged", "error", "timeout", "close", "serverHeartbeatStarted", "serverHeartbeatSucceeded", "serverHeartbeatFailed"];
6388
6450
 
6389
6451
  /**
6390
- * The **MongoClient** class is a class that allows for making Connections to MongoDB.
6391
6452
  * @public
6392
6453
  *
6454
+ * The **MongoClient** class is a class that allows for making Connections to MongoDB.
6455
+ *
6456
+ * **NOTE:** The programmatically provided options take precedence over the URI options.
6457
+ *
6393
6458
  * @remarks
6394
- * The programmatically provided options take precedence over the URI options.
6459
+ *
6460
+ * A MongoClient is the entry point to connecting to a MongoDB server.
6461
+ *
6462
+ * It handles a multitude of features on your application's behalf:
6463
+ * - **Server Host Connection Configuration**: A MongoClient is responsible for reading TLS cert, ca, and crl files if provided.
6464
+ * - **SRV Record Polling**: A "`mongodb+srv`" style connection string is used to have the MongoClient resolve DNS SRV records of all server hostnames which the driver periodically monitors for changes and adjusts its current view of hosts correspondingly.
6465
+ * - **Server Monitoring**: The MongoClient automatically keeps monitoring the health of server nodes in your cluster to reach out to the correct and lowest latency one available.
6466
+ * - **Connection Pooling**: To avoid paying the cost of rebuilding a connection to the server on every operation the MongoClient keeps idle connections preserved for reuse.
6467
+ * - **Session Pooling**: The MongoClient creates logical sessions that enable retryable writes, causal consistency, and transactions. It handles pooling these sessions for reuse in subsequent operations.
6468
+ * - **Cursor Operations**: A MongoClient's cursors use the health monitoring system to send the request for more documents to the same server the query began on.
6469
+ * - **Mongocryptd process**: When using auto encryption, a MongoClient will launch a `mongocryptd` instance for handling encryption if the mongocrypt shared library isn't in use.
6470
+ *
6471
+ * There are many more features of a MongoClient that are not listed above.
6472
+ *
6473
+ * In order to enable these features, a number of asynchronous Node.js resources are established by the driver: Timers, FS Requests, Sockets, etc.
6474
+ * For details on cleanup, please refer to the MongoClient `close()` documentation.
6395
6475
  *
6396
6476
  * @example
6397
6477
  * ```ts
6398
6478
  * import { MongoClient } from 'mongodb';
6399
- *
6400
6479
  * // Enable command monitoring for debugging
6401
- * const client = new MongoClient('mongodb://localhost:27017', { monitorCommands: true });
6402
- *
6403
- * client.on('commandStarted', started => console.log(started));
6404
- * client.db().collection('pets');
6405
- * await client.insertOne({ name: 'spot', kind: 'dog' });
6480
+ * const client = new MongoClient('mongodb://localhost:27017?appName=mflix', { monitorCommands: true });
6406
6481
  * ```
6407
6482
  */
6408
6483
  declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable_2 {
@@ -6414,10 +6489,15 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
6414
6489
  /**
6415
6490
  * The consolidate, parsed, transformed and merged options.
6416
6491
  */
6417
- readonly options: Readonly<Omit<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert'>> & Pick<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert'>;
6492
+ 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'>;
6418
6493
  constructor(url: string, options?: MongoClientOptions);
6419
6494
  /* Excluded from this release type: [Symbol.asyncDispose] */
6420
6495
  /* Excluded from this release type: asyncDispose */
6496
+ /**
6497
+ * Append metadata to the client metadata after instantiation.
6498
+ * @param driverInfo - Information about the application or library.
6499
+ */
6500
+ appendMetadata(driverInfo: DriverInfo): void;
6421
6501
  /* Excluded from this release type: checkForNonGenuineHosts */
6422
6502
  get serverApi(): Readonly<ServerApi | undefined>;
6423
6503
  /* Excluded from this release type: monitorCommands */
@@ -6454,19 +6534,51 @@ declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implement
6454
6534
  connect(): Promise<this>;
6455
6535
  /* Excluded from this release type: _connect */
6456
6536
  /**
6457
- * Cleans up client-side resources used by the MongoCLient and . This includes:
6458
- *
6459
- * - Closes all open, unused connections (see note).
6460
- * - Ends all in-use sessions with {@link ClientSession#endSession|ClientSession.endSession()}.
6461
- * - Ends all unused sessions server-side.
6462
- * - Cleans up any resources being used for auto encryption if auto encryption is enabled.
6463
- *
6464
- * @remarks Any in-progress operations are not killed and any connections used by in progress operations
6465
- * will be cleaned up lazily as operations finish.
6466
- *
6467
- * @param force - Force close, emitting no events
6468
- */
6469
- close(force?: boolean): Promise<void>;
6537
+ * Cleans up resources managed by the MongoClient.
6538
+ *
6539
+ * The close method clears and closes all resources whose lifetimes are managed by the MongoClient.
6540
+ * Please refer to the `MongoClient` class documentation for a high level overview of the client's key features and responsibilities.
6541
+ *
6542
+ * **However,** the close method does not handle the cleanup of resources explicitly created by the user.
6543
+ * Any user-created driver resource with its own `close()` method should be explicitly closed by the user before calling MongoClient.close().
6544
+ * This method is written as a "best effort" attempt to leave behind the least amount of resources server-side when possible.
6545
+ *
6546
+ * The following list defines ideal preconditions and consequent pitfalls if they are not met.
6547
+ * The MongoClient, ClientSession, Cursors and ChangeStreams all support [explicit resource management](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html).
6548
+ * By using explicit resource management to manage the lifetime of driver resources instead of manually managing their lifetimes, the pitfalls outlined below can be avoided.
6549
+ *
6550
+ * The close method performs the following in the order listed:
6551
+ * - Client-side:
6552
+ * - **Close in-use connections**: Any connections that are currently waiting on a response from the server will be closed.
6553
+ * This is performed _first_ to avoid reaching the next step (server-side clean up) and having no available connections to check out.
6554
+ * - _Ideal_: All operations have been awaited or cancelled, and the outcomes, regardless of success or failure, have been processed before closing the client servicing the operation.
6555
+ * - _Pitfall_: When `client.close()` is called and all connections are in use, after closing them, the client must create new connections for cleanup operations, which comes at the cost of new TLS/TCP handshakes and authentication steps.
6556
+ * - Server-side:
6557
+ * - **Close active cursors**: All cursors that haven't been completed will have a `killCursor` operation sent to the server they were initialized on, freeing the server-side resource.
6558
+ * - _Ideal_: Cursors are explicitly closed or completed before `client.close()` is called.
6559
+ * - _Pitfall_: `killCursors` may have to build a new connection if the in-use closure ended all pooled connections.
6560
+ * - **End active sessions**: In-use sessions created with `client.startSession()` or `client.withSession()` or implicitly by the driver will have their `.endSession()` method called.
6561
+ * Contrary to the name of the method, `endSession()` returns the session to the client's pool of sessions rather than end them on the server.
6562
+ * - _Ideal_: Transaction outcomes are awaited and their corresponding explicit sessions are ended before `client.close()` is called.
6563
+ * - _Pitfall_: **This step aborts in-progress transactions**. It is advisable to observe the outcome of a transaction before closing your client.
6564
+ * - **End all pooled sessions**: The `endSessions` command with all session IDs the client has pooled is sent to the server to inform the cluster it can clean them up.
6565
+ * - _Ideal_: No user intervention is expected.
6566
+ * - _Pitfall_: None.
6567
+ *
6568
+ * The remaining shutdown is of the MongoClient resources that are intended to be entirely internal but is documented here as their existence relates to the JS event loop.
6569
+ *
6570
+ * - Client-side (again):
6571
+ * - **Stop all server monitoring**: Connections kept live for detecting cluster changes and roundtrip time measurements are shutdown.
6572
+ * - **Close all pooled connections**: Each server node in the cluster has a corresponding connection pool and all connections in the pool are closed. Any operations waiting to check out a connection will have an error thrown instead of a connection returned.
6573
+ * - **Clear out server selection queue**: Any operations that are in the process of waiting for a server to be selected will have an error thrown instead of a server returned.
6574
+ * - **Close encryption-related resources**: An internal MongoClient created for communicating with `mongocryptd` or other encryption purposes is closed. (Using this same method of course!)
6575
+ *
6576
+ * After the close method completes there should be no MongoClient related resources [ref-ed in Node.js' event loop](https://docs.libuv.org/en/v1.x/handle.html#reference-counting).
6577
+ * This should allow Node.js to exit gracefully if MongoClient resources were the only active handles in the event loop.
6578
+ *
6579
+ * @param _force - currently an unused flag that has no effect. Defaults to `false`.
6580
+ */
6581
+ close(_force?: boolean): Promise<void>;
6470
6582
  private _close;
6471
6583
  /**
6472
6584
  * Create a new Db instance sharing the current socket connections.
@@ -6643,7 +6755,11 @@ declare interface MongoClientOptions extends BSONSerializeOptions, SupportedNode
6643
6755
  minPoolSize?: number;
6644
6756
  /** The maximum number of connections that may be in the process of being established concurrently by the connection pool. */
6645
6757
  maxConnecting?: number;
6646
- /** The maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed. */
6758
+ /**
6759
+ * The maximum amount of time a connection should remain idle in the connection pool before being marked idle, in milliseconds.
6760
+ * If specified, this must be a number greater than or equal to 0, where 0 means there is no limit. Defaults to 0. After this
6761
+ * time passes, the idle collection can be automatically cleaned up in the background.
6762
+ */
6647
6763
  maxIdleTimeMS?: number;
6648
6764
  /** The maximum time in milliseconds that a thread can wait for a connection to become available. */
6649
6765
  waitQueueTimeoutMS?: number;
@@ -6851,14 +6967,14 @@ declare interface MongoDBLogWritable {
6851
6967
  /** @public */
6852
6968
  declare class MongoDBNamespace {
6853
6969
  db: string;
6854
- collection?: string | undefined;
6970
+ collection?: string;
6855
6971
  /**
6856
6972
  * Create a namespace object
6857
6973
  *
6858
6974
  * @param db - database name
6859
6975
  * @param collection - collection name
6860
6976
  */
6861
- constructor(db: string, collection?: string | undefined);
6977
+ constructor(db: string, collection?: string);
6862
6978
  toString(): string;
6863
6979
  withCollection(collection: string): MongoDBCollectionNamespace;
6864
6980
  static fromString(namespace?: string): MongoDBNamespace;
@@ -7005,6 +7121,15 @@ declare interface MongoDBOIDCLogEventsMap {
7005
7121
  'mongodb-oidc-plugin:inbound-http-request': (event: {
7006
7122
  url: string;
7007
7123
  }) => void;
7124
+ 'mongodb-oidc-plugin:outbound-http-request-failed': (event: {
7125
+ url: string;
7126
+ error: string;
7127
+ }) => void;
7128
+ 'mongodb-oidc-plugin:outbound-http-request-completed': (event: {
7129
+ url: string;
7130
+ status: number;
7131
+ statusText: string;
7132
+ }) => void;
7008
7133
  'mongodb-oidc-plugin:received-server-params': (event: {
7009
7134
  params: OIDCCallbackParams_2;
7010
7135
  }) => void;
@@ -7149,8 +7274,16 @@ declare interface MongoDBOIDCPluginOptions {
7149
7274
  throwOnIncompatibleSerializedState?: boolean;
7150
7275
  /**
7151
7276
  * Provide custom HTTP options for individual HTTP calls.
7277
+ *
7278
+ * @deprecated Use a custom `fetch` function instead.
7152
7279
  */
7153
7280
  customHttpOptions?: HttpOptions | ((url: string, options: Readonly<HttpOptions>) => HttpOptions);
7281
+ /**
7282
+ * Provide a custom `fetch` function to be used for HTTP calls.
7283
+ *
7284
+ * Any API that is compatible with the web `fetch` API can be used here.
7285
+ */
7286
+ customFetch?: (url: string, options: Readonly<unknown>) => Promise<Response>;
7154
7287
  /**
7155
7288
  * Pass ID tokens in place of access tokens. For debugging/working around
7156
7289
  * broken identity providers.
@@ -7256,8 +7389,10 @@ declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEn
7256
7389
  compressors: CompressorName[];
7257
7390
  writeConcern: WriteConcern;
7258
7391
  dbName: string;
7392
+ /** @deprecated - Will be made internal in a future major release. */
7259
7393
  metadata: ClientMetadata;
7260
- /* Excluded from this release type: extendedMetadata */
7394
+ extendedMetadata: Promise<Document_2>;
7395
+ additionalDriverInfo: DriverInfo[];
7261
7396
  /* Excluded from this release type: autoEncrypter */
7262
7397
  /* Excluded from this release type: tokenCache */
7263
7398
  proxyHost?: string;
@@ -7455,6 +7590,8 @@ declare interface OIDCCallbackParams {
7455
7590
  idpInfo?: IdPInfo;
7456
7591
  /** The refresh token, if applicable, to be used by the callback to request a new token from the issuer. */
7457
7592
  refreshToken?: string;
7593
+ /** The token audience for GCP and Azure. */
7594
+ tokenAudience?: string;
7458
7595
  }
7459
7596
 
7460
7597
  /**
@@ -7523,7 +7660,6 @@ declare interface OperationOptions extends BSONSerializeOptions {
7523
7660
  /** The preferred read preference (ReadPreference.primary, ReadPreference.primary_preferred, ReadPreference.secondary, ReadPreference.secondary_preferred, ReadPreference.nearest). */
7524
7661
  readPreference?: ReadPreferenceLike;
7525
7662
  /* Excluded from this release type: bypassPinningCheck */
7526
- omitReadPreference?: boolean;
7527
7663
  /* Excluded from this release type: omitMaxTimeMS */
7528
7664
  /**
7529
7665
  * @experimental
@@ -7638,6 +7774,11 @@ declare interface ProxyEventMap {
7638
7774
  retryableError: boolean;
7639
7775
  retriesLeft: number;
7640
7776
  }) => void;
7777
+ 'proxy:connect': (ev: {
7778
+ agent: AgentWithInitialize;
7779
+ req: ClientRequest;
7780
+ opts: AgentConnectOpts & Partial<SecureContextOptions>;
7781
+ }) => void;
7641
7782
  }
7642
7783
 
7643
7784
  declare interface ProxyLogEmitter {
@@ -7702,7 +7843,7 @@ declare interface Readable_2 {
7702
7843
  distinct(database: string, collection: string, fieldName: string, filter?: Document_2, options?: DistinctOptions, dbOptions?: DbOptions): Promise<Document_2>;
7703
7844
  estimatedDocumentCount(database: string, collection: string, options?: EstimatedDocumentCountOptions, dbOptions?: DbOptions): Promise<number>;
7704
7845
  find(database: string, collection: string, filter?: Document_2, options?: FindOptions, dbOptions?: DbOptions): ServiceProviderFindCursor;
7705
- getTopology(): any;
7846
+ getTopologyDescription(): TopologyDescription_2 | undefined;
7706
7847
  getIndexes(database: string, collection: string, options: ListIndexesOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
7707
7848
  listCollections(database: string, filter?: Document_2, options?: ListCollectionsOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
7708
7849
  readPreferenceFromOptions(options?: Omit<ReadPreferenceFromOptions, 'session'>): ReadPreferenceLike | undefined;
@@ -7910,7 +8051,7 @@ declare interface RenameOptions extends CommandOperationOptions {
7910
8051
 
7911
8052
  /** @public */
7912
8053
  declare interface ReplaceOneModel<TSchema extends Document_2 = Document_2> {
7913
- /** The filter to limit the replaced document. */
8054
+ /** The filter that specifies which document to replace. In the case of multiple matches, the first document matched is replaced. */
7914
8055
  filter: Filter<TSchema>;
7915
8056
  /** The document with which to replace the matched document. */
7916
8057
  replacement: WithoutId<TSchema>;
@@ -7920,6 +8061,8 @@ declare interface ReplaceOneModel<TSchema extends Document_2 = Document_2> {
7920
8061
  hint?: Hint;
7921
8062
  /** When true, creates a new document if no document matches the query. */
7922
8063
  upsert?: boolean;
8064
+ /** Specifies the sort order for the documents matched by the filter. */
8065
+ sort?: Sort;
7923
8066
  }
7924
8067
 
7925
8068
  /** @public */
@@ -7934,6 +8077,8 @@ declare interface ReplaceOptions extends CommandOperationOptions {
7934
8077
  upsert?: boolean;
7935
8078
  /** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */
7936
8079
  let?: Document_2;
8080
+ /** Specifies the sort order for the documents matched by the filter. */
8081
+ sort?: Sort;
7937
8082
  }
7938
8083
 
7939
8084
  export declare class ReplicaSet<M extends GenericServerSideSchema = GenericServerSideSchema, D extends GenericDatabaseSchema = GenericDatabaseSchema> extends ShellApiWithMongoClass {
@@ -8068,7 +8213,8 @@ declare type RunCommandOptions = {
8068
8213
  */
8069
8214
  timeoutMS?: number;
8070
8215
  /* Excluded from this release type: omitMaxTimeMS */
8071
- } & BSONSerializeOptions;
8216
+ /* Excluded from this release type: bypassPinningCheck */
8217
+ } & BSONSerializeOptions & Abortable;
8072
8218
 
8073
8219
  /** @public */
8074
8220
  declare type RunCursorCommandOptions = {
@@ -8218,6 +8364,11 @@ declare class ServerDescription {
8218
8364
  equals(other?: ServerDescription | null): boolean;
8219
8365
  }
8220
8366
 
8367
+ declare interface ServerDescription_2 {
8368
+ type?: ServerType;
8369
+ setName?: string | null;
8370
+ }
8371
+
8221
8372
  /**
8222
8373
  * Emitted when server description changes, but does NOT include changes to the RTT.
8223
8374
  * @public
@@ -8730,7 +8881,7 @@ declare class ShellInstanceState {
8730
8881
  constructor(initialServiceProvider: ServiceProvider, messageBus?: any, cliOptions?: ShellCliOptions);
8731
8882
  fetchConnectionInfo(): Promise<ConnectionInfo_2 | undefined>;
8732
8883
  cachedConnectionInfo(): ConnectionInfo_2 | undefined;
8733
- close(force: boolean): Promise<void>;
8884
+ close(): Promise<void>;
8734
8885
  setPreFetchCollectionAndDatabaseNames(value: boolean): void;
8735
8886
  setDbFunc(newDb: any): DatabaseWithSchema;
8736
8887
  setCtx(contextObject: any): void;
@@ -8849,16 +9000,25 @@ declare interface SnippetsTransformErrorEvent {
8849
9000
 
8850
9001
  /** @public */
8851
9002
  declare type Sort = string | Exclude<SortDirection, {
8852
- $meta: string;
8853
- }> | string[] | {
8854
- [key: string]: SortDirection;
8855
- } | Map<string, SortDirection> | [string, SortDirection][] | [string, SortDirection];
9003
+ readonly $meta: string;
9004
+ }> | ReadonlyArray<string> | {
9005
+ readonly [key: string]: SortDirection;
9006
+ } | ReadonlyMap<string, SortDirection> | ReadonlyArray<readonly [string, SortDirection]> | readonly [string, SortDirection];
8856
9007
 
8857
9008
  /** @public */
8858
9009
  declare type SortDirection = 1 | -1 | 'asc' | 'desc' | 'ascending' | 'descending' | {
9010
+ readonly $meta: string;
9011
+ };
9012
+
9013
+ /** Below stricter types were created for sort that correspond with type that the cmd takes */
9014
+ /** @public */
9015
+ declare type SortDirectionForCmd = 1 | -1 | {
8859
9016
  $meta: string;
8860
9017
  };
8861
9018
 
9019
+ /** @public */
9020
+ declare type SortForCmd = Map<string, SortDirectionForCmd>;
9021
+
8862
9022
  declare type StandardJSONSchema = JSONSchema4;
8863
9023
 
8864
9024
  declare interface StartLoadingCliScriptsEvent {
@@ -8916,6 +9076,8 @@ declare type SupportedNodeConnectionOptions = SupportedTLSConnectionOptions & Su
8916
9076
  declare type SupportedSocketOptions = Pick<TcpNetConnectOpts & {
8917
9077
  autoSelectFamily?: boolean;
8918
9078
  autoSelectFamilyAttemptTimeout?: number;
9079
+ /** Node.JS socket option to set the time the first keepalive probe is sent on an idle socket. Defaults to 120000ms */
9080
+ keepAliveInitialDelay?: number;
8919
9081
  }, (typeof LEGAL_TCP_SOCKET_OPTIONS)[number]>;
8920
9082
 
8921
9083
  /** @public */
@@ -8931,6 +9093,39 @@ declare type TagSet = {
8931
9093
  [key: string]: string;
8932
9094
  };
8933
9095
 
9096
+ /**
9097
+ * Options for a Queryable Encryption field supporting text queries.
9098
+ *
9099
+ * @public
9100
+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
9101
+ */
9102
+ declare interface TextQueryOptions {
9103
+ /** Indicates that text indexes for this field are case sensitive */
9104
+ caseSensitive: boolean;
9105
+ /** Indicates that text indexes for this field are diacritic sensitive. */
9106
+ diacriticSensitive: boolean;
9107
+ prefix?: {
9108
+ /** The maximum allowed query length. */
9109
+ strMaxQueryLength: Int32 | number;
9110
+ /** The minimum allowed query length. */
9111
+ strMinQueryLength: Int32 | number;
9112
+ };
9113
+ suffix?: {
9114
+ /** The maximum allowed query length. */
9115
+ strMaxQueryLength: Int32 | number;
9116
+ /** The minimum allowed query length. */
9117
+ strMinQueryLength: Int32 | number;
9118
+ };
9119
+ substring?: {
9120
+ /** The maximum allowed length to insert. */
9121
+ strMaxLength: Int32 | number;
9122
+ /** The maximum allowed query length. */
9123
+ strMaxQueryLength: Int32 | number;
9124
+ /** The minimum allowed query length. */
9125
+ strMinQueryLength: Int32 | number;
9126
+ };
9127
+ }
9128
+
8934
9129
  /** @public
8935
9130
  * Configuration options for timeseries collections
8936
9131
  * @see https://www.mongodb.com/docs/manual/core/timeseries-collections/
@@ -9004,6 +9199,12 @@ declare class TopologyDescription {
9004
9199
  toJSON(): Document_2;
9005
9200
  }
9006
9201
 
9202
+ declare interface TopologyDescription_2 {
9203
+ type?: TopologyType;
9204
+ setName?: string | null;
9205
+ servers?: Map<string, ServerDescription_2>;
9206
+ }
9207
+
9007
9208
  /**
9008
9209
  * Emitted when topology description changes.
9009
9210
  * @public
@@ -9077,23 +9278,32 @@ declare interface TopologyVersion {
9077
9278
 
9078
9279
  /**
9079
9280
  * @public
9281
+ * @deprecated - Will be made internal in a future major release.
9080
9282
  * A class maintaining state related to a server transaction. Internal Only
9081
9283
  */
9082
9284
  declare class Transaction {
9083
9285
  /* Excluded from this release type: state */
9286
+ /** @deprecated - Will be made internal in a future major release. */
9084
9287
  options: TransactionOptions;
9085
9288
  /* Excluded from this release type: _pinnedServer */
9086
9289
  /* Excluded from this release type: _recoveryToken */
9087
9290
  /* Excluded from this release type: __constructor */
9088
9291
  /* Excluded from this release type: server */
9292
+ /** @deprecated - Will be made internal in a future major release. */
9089
9293
  get recoveryToken(): Document_2 | undefined;
9294
+ /** @deprecated - Will be made internal in a future major release. */
9090
9295
  get isPinned(): boolean;
9091
- /** @returns Whether the transaction has started */
9296
+ /**
9297
+ * @deprecated - Will be made internal in a future major release.
9298
+ * @returns Whether the transaction has started
9299
+ */
9092
9300
  get isStarting(): boolean;
9093
9301
  /**
9302
+ * @deprecated - Will be made internal in a future major release.
9094
9303
  * @returns Whether this session is presently in a transaction
9095
9304
  */
9096
9305
  get isActive(): boolean;
9306
+ /** @deprecated - Will be made internal in a future major release. */
9097
9307
  get isCommitted(): boolean;
9098
9308
  /* Excluded from this release type: transition */
9099
9309
  /* Excluded from this release type: pinServer */
@@ -9274,7 +9484,7 @@ declare interface UpdateManyModel<TSchema extends Document_2 = Document_2> {
9274
9484
 
9275
9485
  /** @public */
9276
9486
  declare interface UpdateOneModel<TSchema extends Document_2 = Document_2> {
9277
- /** The filter to limit the updated documents. */
9487
+ /** The filter that specifies which document to update. In the case of multiple matches, the first document matched is updated. */
9278
9488
  filter: Filter<TSchema>;
9279
9489
  /**
9280
9490
  * The modifications to apply. The value can be either:
@@ -9290,6 +9500,8 @@ declare interface UpdateOneModel<TSchema extends Document_2 = Document_2> {
9290
9500
  hint?: Hint;
9291
9501
  /** When true, creates a new document if no document matches the query. */
9292
9502
  upsert?: boolean;
9503
+ /** Specifies the sort order for the documents matched by the filter. */
9504
+ sort?: Sort;
9293
9505
  }
9294
9506
 
9295
9507
  /** @public */
@@ -9350,6 +9562,8 @@ declare interface UpdateStatement {
9350
9562
  arrayFilters?: Document_2[];
9351
9563
  /** A document or string that specifies the index to use to support the query predicate. */
9352
9564
  hint?: Hint;
9565
+ /** Specifies the sort order for the documents matched by the filter. */
9566
+ sort?: SortForCmd;
9353
9567
  }
9354
9568
 
9355
9569
  declare interface UseEvent {
@@ -9401,7 +9615,9 @@ declare interface Writable {
9401
9615
  insertOne(database: string, collection: string, doc: Document_2, options: InsertOneOptions, dbOptions?: DbOptions): Promise<InsertOneResult>;
9402
9616
  replaceOne(database: string, collection: string, filter: Document_2, replacement: Document_2, options?: ReplaceOptions, dbOptions?: DbOptions): Promise<UpdateResult>;
9403
9617
  updateMany(database: string, collection: string, filter: Document_2, update: Document_2, options?: UpdateOptions, dbOptions?: DbOptions): Promise<UpdateResult>;
9404
- updateOne(database: string, collection: string, filter: Document_2, update: Document_2, options?: UpdateOptions, dbOptions?: DbOptions): Promise<UpdateResult>;
9618
+ updateOne(database: string, collection: string, filter: Document_2, update: Document_2, options?: UpdateOptions & {
9619
+ sort?: Document_2;
9620
+ }, dbOptions?: DbOptions): Promise<UpdateResult>;
9405
9621
  createIndexes(database: string, collection: string, indexSpecs: Document_2[], options?: CreateIndexesOptions, dbOptions?: DbOptions): Promise<string[]>;
9406
9622
  dropCollection(database: string, collection: string, options: DropCollectionOptions, dbOptions?: DbOptions): Promise<boolean>;
9407
9623
  renameCollection(database: string, oldName: string, newName: string, options?: RenameOptions, dbOptions?: DbOptions): Promise<Collection_2>;