@mongosh/shell-api 3.13.0 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/lib/api-export.js +1 -1
  2. package/lib/api-processed.d.ts +109 -58
  3. package/lib/api-raw.d.ts +109 -58
  4. package/lib/bulk.d.ts +3 -2
  5. package/lib/bulk.js.map +1 -1
  6. package/lib/collection.d.ts +21 -13
  7. package/lib/collection.js +53 -1
  8. package/lib/collection.js.map +1 -1
  9. package/lib/cursor.d.ts +17 -17
  10. package/lib/database.d.ts +6 -5
  11. package/lib/database.js.map +1 -1
  12. package/lib/decorators.d.ts +6 -2
  13. package/lib/decorators.js +9 -2
  14. package/lib/decorators.js.map +1 -1
  15. package/lib/explainable-cursor.d.ts +1 -0
  16. package/lib/explainable-cursor.js +15 -7
  17. package/lib/explainable-cursor.js.map +1 -1
  18. package/lib/explainable.d.ts +10 -9
  19. package/lib/explainable.js.map +1 -1
  20. package/lib/helpers.d.ts +3 -2
  21. package/lib/helpers.js.map +1 -1
  22. package/lib/mongo.d.ts +4 -1
  23. package/lib/mongo.js +5 -0
  24. package/lib/mongo.js.map +1 -1
  25. package/lib/mongosh-version.d.ts +1 -1
  26. package/lib/mongosh-version.js +1 -1
  27. package/lib/mql-types.d.ts +4 -0
  28. package/lib/mql-types.js +3 -0
  29. package/lib/mql-types.js.map +1 -0
  30. package/lib/plan-cache.d.ts +3 -2
  31. package/lib/plan-cache.js.map +1 -1
  32. package/lib/shard.d.ts +4 -3
  33. package/lib/shard.js.map +1 -1
  34. package/lib/shell-api.js +29 -5
  35. package/lib/shell-api.js.map +1 -1
  36. package/lib/shell-instance-state.d.ts +3 -0
  37. package/lib/shell-instance-state.js +76 -0
  38. package/lib/shell-instance-state.js.map +1 -1
  39. package/lib/stream-processor.d.ts +2 -1
  40. package/lib/stream-processor.js.map +1 -1
  41. package/lib/streams.d.ts +3 -2
  42. package/lib/streams.js.map +1 -1
  43. package/package.json +8 -6
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import type { Agent } from 'https';
4
+ import type { AutocompletionContext } from '@mongodb-js/mongodb-ts-autocomplete';
4
5
  import { Binary } from 'bson';
5
6
  import { BSONRegExp } from 'bson';
6
7
  import { BSONSymbol } from 'bson';
@@ -1135,11 +1136,11 @@ declare class Bulk extends ShellApiWithMongoClass {
1135
1136
  /*
1136
1137
  Adds a find to the bulk operation.
1137
1138
  */
1138
- find(query: Document_2): BulkFindOp;
1139
+ find(query: MQLQuery): BulkFindOp;
1139
1140
  /*
1140
1141
  Adds an insert to the bulk operation.
1141
1142
  */
1142
- insert(document: Document_2): Bulk;
1143
+ insert(document: MQLDocument): Bulk;
1143
1144
  toJSON(): Record<'nInsertOps' | 'nUpdateOps' | 'nRemoveOps' | 'nBatches', number>;
1144
1145
  /*
1145
1146
  Returns as a string a JSON document that contains the number of operations and batches in the Bulk() object.
@@ -2929,6 +2930,7 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2929
2930
  _mongo: Mongo<M>;
2930
2931
  _database: DatabaseWithSchema<M, D>;
2931
2932
  _name: N;
2933
+ _cachedSampleDocs: Document_2[];
2932
2934
  constructor(mongo: Mongo<M>, database: DatabaseWithSchema<M, D> | Database<M, D>, name: N);
2933
2935
  [namespaceInfo](): Namespace;
2934
2936
  [asPrintable](): string;
@@ -2936,17 +2938,17 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2936
2938
  /*
2937
2939
  Calculates aggregate values for the data in a collection or a view.
2938
2940
  */
2939
- aggregate(pipeline: Document_2[], options: AggregateOptions & {
2941
+ aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
2940
2942
  explain: ExplainVerbosityLike;
2941
2943
  }): Document_2;
2942
2944
  /*
2943
2945
  Calculates aggregate values for the data in a collection or a view.
2944
2946
  */
2945
- aggregate(pipeline: Document_2[], options?: AggregateOptions): AggregationCursor_2;
2947
+ aggregate(pipeline: MQLPipeline, options?: AggregateOptions): AggregationCursor_2;
2946
2948
  /*
2947
2949
  Calculates aggregate values for the data in a collection or a view.
2948
2950
  */
2949
- aggregate(...stages: Document_2[]): AggregationCursor_2;
2951
+ aggregate(...stages: MQLPipeline): AggregationCursor_2;
2950
2952
  /*
2951
2953
  Performs multiple write operations with controls for order of execution.
2952
2954
  */
@@ -2958,7 +2960,7 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2958
2960
  /*
2959
2961
  Returns the count of documents that match the query for a collection or view.
2960
2962
  */
2961
- countDocuments(query?: Document_2, options?: CountDocumentsOptions): number;
2963
+ countDocuments(query?: MQLQuery, options?: CountDocumentsOptions): number;
2962
2964
  /*
2963
2965
  Removes all documents that match the filter from a collection.
2964
2966
  */
@@ -2974,11 +2976,11 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2974
2976
  /*
2975
2977
  Finds the distinct values for a specified field across a single collection or view and returns the results in an array.
2976
2978
  */
2977
- distinct(field: string, query: Document_2): Document_2;
2979
+ distinct(field: string, query: MQLQuery): Document_2;
2978
2980
  /*
2979
2981
  Finds the distinct values for a specified field across a single collection or view and returns the results in an array.
2980
2982
  */
2981
- distinct(field: string, query: Document_2, options: DistinctOptions): Document_2;
2983
+ distinct(field: string, query: MQLQuery, options: DistinctOptions): Document_2;
2982
2984
  /*
2983
2985
  Returns the count of all documents in a collection or view.
2984
2986
  */
@@ -2986,7 +2988,7 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2986
2988
  /*
2987
2989
  Selects documents in a collection or view.
2988
2990
  */
2989
- find(query?: Document_2, projection?: Document_2, options?: FindOptions): Cursor;
2991
+ find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Cursor;
2990
2992
  /*
2991
2993
  Modifies and returns a single document.
2992
2994
  */
@@ -2994,7 +2996,7 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
2994
2996
  /*
2995
2997
  Selects documents in a collection or view.
2996
2998
  */
2997
- findOne(query?: Document_2, projection?: Document_2, options?: FindOptions): C['schema'] | null;
2999
+ findOne(query?: MQLQuery, projection?: Document_2, options?: FindOptions): MQLDocument | null;
2998
3000
  /*
2999
3001
  Renames a collection.
3000
3002
  */
@@ -3014,15 +3016,15 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3014
3016
  /*
3015
3017
  Inserts a document or documents into a collection.
3016
3018
  */
3017
- insert(docs: Document_2 | Document_2[], options?: BulkWriteOptions): InsertManyResult_2;
3019
+ insert(docs: MQLDocument | MQLDocument[], options?: BulkWriteOptions): InsertManyResult_2;
3018
3020
  /*
3019
3021
  Inserts multiple documents into a collection.
3020
3022
  */
3021
- insertMany(docs: Document_2[], options?: BulkWriteOptions): InsertManyResult_2;
3023
+ insertMany(docs: MQLDocument[], options?: BulkWriteOptions): InsertManyResult_2;
3022
3024
  /*
3023
3025
  Inserts a document into a collection.
3024
3026
  */
3025
- insertOne(doc: Document_2, options?: InsertOneOptions): InsertOneResult_2;
3027
+ insertOne(doc: MQLDocument, options?: InsertOneOptions): InsertOneResult_2;
3026
3028
  /*
3027
3029
  Checks if a collection is capped
3028
3030
  */
@@ -3030,7 +3032,7 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3030
3032
  /*
3031
3033
  Removes documents from a collection.
3032
3034
  */
3033
- remove(query: Document_2, options?: boolean | RemoveShellOptions): DeleteResult_2 | Document_2;
3035
+ remove(query: MQLQuery, options?: boolean | RemoveShellOptions): DeleteResult_2 | Document_2;
3034
3036
  /*
3035
3037
  Replaces a single document within the collection based on the filter.
3036
3038
  */
@@ -3188,9 +3190,16 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3188
3190
  */
3189
3191
  getShardDistribution(): CommandResult<GetShardDistributionResult>;
3190
3192
  /*
3193
+ Returns a document containing the shards where this collection is located as well as whether the collection itself is sharded.
3194
+ */
3195
+ getShardLocation(): {
3196
+ shards: string[];
3197
+ sharded: boolean;
3198
+ };
3199
+ /*
3191
3200
  Opens a change stream cursor on the collection
3192
3201
  */
3193
- watch(pipeline?: Document_2[] | ChangeStreamOptions, options?: ChangeStreamOptions): ChangeStreamCursor;
3202
+ watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): ChangeStreamCursor;
3194
3203
  /*
3195
3204
  Hides an existing index from the query planner.
3196
3205
  */
@@ -3243,6 +3252,8 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
3243
3252
  Updates the sepecified search index.
3244
3253
  */
3245
3254
  updateSearchIndex(indexName: string, definition: Document_2): void;
3255
+ _getSampleDocs(): Promise<Document_2[]>;
3256
+ _getSampleDocsForCompletion(): Promise<Document_2[]>;
3246
3257
  }
3247
3258
 
3248
3259
  /**
@@ -4520,23 +4531,23 @@ declare class Cursor extends AggregateOrFindCursor<ServiceProviderFindCursor> {
4520
4531
  /*
4521
4532
  Adds OP_QUERY wire protocol flags, such as the tailable flag, to change the behavior of queries. Accepts: DBQuery.Option fields tailable, slaveOk, noTimeout, awaitData, exhaust, partial.
4522
4533
  */
4523
- addOption(optionFlagNumber: number): Cursor;
4534
+ addOption(optionFlagNumber: number): this;
4524
4535
  /*
4525
4536
  Sets the 'allowDiskUse' option. If no argument is passed, the default is true.
4526
4537
  */
4527
- allowDiskUse(allow?: boolean): Cursor;
4538
+ allowDiskUse(allow?: boolean): this;
4528
4539
  /*
4529
4540
  Sets the 'partial' option to true.
4530
4541
  */
4531
- allowPartialResults(): Cursor;
4542
+ allowPartialResults(): this;
4532
4543
  /*
4533
4544
  Specifies the collation for the cursor returned by the db.collection.find(). To use, append to the db.collection.find().
4534
4545
  */
4535
- collation(spec: CollationOptions): Cursor;
4546
+ collation(spec: CollationOptions): this;
4536
4547
  /*
4537
4548
  Adds a comment field to the query.
4538
4549
  */
4539
- comment(cmt: string): Cursor;
4550
+ comment(cmt: string): this;
4540
4551
  /*
4541
4552
  Counts the number of documents referenced by a cursor.
4542
4553
  */
@@ -4548,23 +4559,23 @@ declare class Cursor extends AggregateOrFindCursor<ServiceProviderFindCursor> {
4548
4559
  /*
4549
4560
  Call this method on a query to override MongoDB’s default index selection and query optimization process. Use db.collection.getIndexes() to return the list of current indexes on a collection.
4550
4561
  */
4551
- hint(index: string): Cursor;
4562
+ hint(index: string): this;
4552
4563
  /*
4553
4564
  Use the limit() method on a cursor to specify the maximum number of documents the cursor will return.
4554
4565
  */
4555
- limit(value: number): Cursor;
4566
+ limit(value: number): this;
4556
4567
  /*
4557
4568
  Specifies the exclusive upper bound for a specific index in order to constrain the results of find(). max() provides a way to specify an upper bound on compound key indexes.
4558
4569
  */
4559
- max(indexBounds: Document_2): Cursor;
4570
+ max(indexBounds: Document_2): this;
4560
4571
  /*
4561
4572
  Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)
4562
4573
  */
4563
- maxAwaitTimeMS(value: number): Cursor;
4574
+ maxAwaitTimeMS(value: number): this;
4564
4575
  /*
4565
4576
  Specifies the inclusive lower bound for a specific index in order to constrain the results of find(). min() provides a way to specify lower bounds on compound key indexes.
4566
4577
  */
4567
- min(indexBounds: Document_2): Cursor;
4578
+ min(indexBounds: Document_2): this;
4568
4579
  /*
4569
4580
  The next document in the cursor returned by the db.collection.find() method. NOTE: if the cursor is tailable with awaitData then hasNext will block until a document is returned. To check if a document is in the cursor's batch without waiting, use tryNext instead
4570
4581
  */
@@ -4572,19 +4583,19 @@ declare class Cursor extends AggregateOrFindCursor<ServiceProviderFindCursor> {
4572
4583
  /*
4573
4584
  Instructs the server to avoid closing a cursor automatically after a period of inactivity.
4574
4585
  */
4575
- noCursorTimeout(): Cursor;
4586
+ noCursorTimeout(): this;
4576
4587
  /*
4577
4588
  Sets oplogReplay cursor flag to true.
4578
4589
  */
4579
- oplogReplay(): Cursor;
4590
+ oplogReplay(): this;
4580
4591
  /*
4581
4592
  Append readPref() to a cursor to control how the client routes the query to members of the replica set.
4582
4593
  */
4583
- readPref(mode: ReadPreferenceLike, tagSet?: TagSet[], hedgeOptions?: HedgeOptions): Cursor;
4594
+ readPref(mode: ReadPreferenceLike, tagSet?: TagSet[], hedgeOptions?: HedgeOptions): this;
4584
4595
  /*
4585
4596
  Modifies the cursor to return index keys rather than the documents.
4586
4597
  */
4587
- returnKey(enabled: boolean): Cursor;
4598
+ returnKey(enabled: boolean): this;
4588
4599
  /*
4589
4600
  A count of the number of documents that match the db.collection.find() query after applying any cursor.skip() and cursor.limit() methods.
4590
4601
  */
@@ -4594,7 +4605,7 @@ declare class Cursor extends AggregateOrFindCursor<ServiceProviderFindCursor> {
4594
4605
  */
4595
4606
  tailable(opts?: {
4596
4607
  awaitData: boolean;
4597
- }): Cursor;
4608
+ }): this;
4598
4609
  /*
4599
4610
  deprecated, non-functional
4600
4611
  */
@@ -4602,11 +4613,11 @@ declare class Cursor extends AggregateOrFindCursor<ServiceProviderFindCursor> {
4602
4613
  /*
4603
4614
  Modifies the output of a query by adding a field $recordId to matching documents. $recordId is the internal key which uniquely identifies a document in a collection.
4604
4615
  */
4605
- showRecordId(): Cursor;
4616
+ showRecordId(): this;
4606
4617
  /*
4607
4618
  Specify a read concern for the db.collection.find() method.
4608
4619
  */
4609
- readConcern(level: ReadConcernLevel): Cursor;
4620
+ readConcern(level: ReadConcernLevel): this;
4610
4621
  }
4611
4622
 
4612
4623
  /** @public */
@@ -4715,17 +4726,17 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
4715
4726
  /*
4716
4727
  Runs a specified admin/diagnostic pipeline which does not require an underlying collection.
4717
4728
  */
4718
- aggregate(pipeline: Document_2[], options: AggregateOptions & {
4729
+ aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
4719
4730
  explain: ExplainVerbosityLike;
4720
4731
  }): Document_2;
4721
4732
  /*
4722
4733
  Runs a specified admin/diagnostic pipeline which does not require an underlying collection.
4723
4734
  */
4724
- aggregate(pipeline: Document_2[], options?: AggregateOptions): AggregationCursor_2;
4735
+ aggregate(pipeline: MQLPipeline, options?: AggregateOptions): AggregationCursor_2;
4725
4736
  /*
4726
4737
  Runs a specified admin/diagnostic pipeline which does not require an underlying collection.
4727
4738
  */
4728
- aggregate(...stages: Document_2[]): AggregationCursor_2;
4739
+ aggregate(...stages: MQLPipeline): AggregationCursor_2;
4729
4740
  /*
4730
4741
  Returns another database without modifying the db variable in the shell environment.
4731
4742
  */
@@ -4800,7 +4811,7 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
4800
4811
  /*
4801
4812
  Create new view
4802
4813
  */
4803
- createView(name: string, source: string, pipeline: Document_2[], options?: CreateCollectionOptions): {
4814
+ createView(name: string, source: string, pipeline: MQLPipeline, options?: CreateCollectionOptions): {
4804
4815
  ok: number;
4805
4816
  };
4806
4817
  /*
@@ -4979,7 +4990,7 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
4979
4990
  /*
4980
4991
  Opens a change stream cursor on the database
4981
4992
  */
4982
- watch(pipeline?: Document_2[] | ChangeStreamOptions, options?: ChangeStreamOptions): ChangeStreamCursor;
4993
+ watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): ChangeStreamCursor;
4983
4994
  /*
4984
4995
  (Experimental) Runs a SQL query against Atlas Data Lake. Note: this is an experimental feature that may be subject to change in future releases.
4985
4996
  */
@@ -5537,15 +5548,15 @@ declare class Explainable extends ShellApiWithMongoClass {
5537
5548
  /*
5538
5549
  Returns information on the query plan.
5539
5550
  */
5540
- find(query?: Document_2, projection?: Document_2, options?: FindOptions): ExplainableCursor_2;
5551
+ find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): ExplainableCursor_2;
5541
5552
  /*
5542
5553
  Provides information on the query plan for db.collection.aggregate() method.
5543
5554
  */
5544
- aggregate(pipeline: Document_2[], options: Document_2): Document_2;
5555
+ aggregate(pipeline: MQLPipeline, options: Document_2): Document_2;
5545
5556
  /*
5546
5557
  Provides information on the query plan for db.collection.aggregate() method.
5547
5558
  */
5548
- aggregate(...stages: Document_2[]): Document_2;
5559
+ aggregate(...stages: MQLPipeline): Document_2;
5549
5560
  /*
5550
5561
  Returns information on the query plan for db.collection.count().
5551
5562
  */
@@ -5557,11 +5568,11 @@ declare class Explainable extends ShellApiWithMongoClass {
5557
5568
  /*
5558
5569
  Returns information on the query plan for db.collection.distinct().
5559
5570
  */
5560
- distinct(field: string, query: Document_2): Document_2;
5571
+ distinct(field: string, query: MQLQuery): Document_2;
5561
5572
  /*
5562
5573
  Returns information on the query plan for db.collection.distinct().
5563
5574
  */
5564
- distinct(field: string, query: Document_2, options: DistinctOptions): Document_2;
5575
+ distinct(field: string, query: MQLQuery, options: DistinctOptions): Document_2;
5565
5576
  /*
5566
5577
  Returns information on the query plan for db.collection.findAndModify().
5567
5578
  */
@@ -5569,19 +5580,19 @@ declare class Explainable extends ShellApiWithMongoClass {
5569
5580
  /*
5570
5581
  Returns information on the query plan for db.collection.findOneAndDelete().
5571
5582
  */
5572
- findOneAndDelete(filter: Document_2, options?: FindOneAndDeleteOptions): Document_2 | null;
5583
+ findOneAndDelete(filter: MQLQuery, options?: FindOneAndDeleteOptions): Document_2 | null;
5573
5584
  /*
5574
5585
  Returns information on the query plan for db.collection.findOneAndReplace().
5575
5586
  */
5576
- findOneAndReplace(filter: Document_2, replacement: Document_2, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Document_2;
5587
+ findOneAndReplace(filter: MQLQuery, replacement: MQLDocument, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Document_2;
5577
5588
  /*
5578
5589
  Returns information on the query plan for db.collection.findOneAndUpdate().
5579
5590
  */
5580
- findOneAndUpdate(filter: Document_2, update: Document_2, options?: FindAndModifyShellOptions<FindOneAndUpdateOptions>): Document_2;
5591
+ findOneAndUpdate(filter: MQLQuery, update: MQLDocument, options?: FindAndModifyShellOptions<FindOneAndUpdateOptions>): Document_2;
5581
5592
  /*
5582
5593
  Returns information on the query plan for db.collection.remove().
5583
5594
  */
5584
- remove(query: Document_2, options?: boolean | RemoveShellOptions): Document_2;
5595
+ remove(query: MQLQuery, options?: boolean | RemoveShellOptions): Document_2;
5585
5596
  /*
5586
5597
  Returns information on the query plan for db.collection.update().
5587
5598
  */
@@ -5629,6 +5640,7 @@ declare class ExplainableCursor_2 extends Cursor {
5629
5640
  _explained: any;
5630
5641
  constructor(mongo: Mongo, cursor: Cursor, verbosity: ExplainVerbosityLike);
5631
5642
  [asPrintable](): Promise<any>;
5643
+ finish(): Promise<any>;
5632
5644
  }
5633
5645
 
5634
5646
  /** @public */
@@ -5746,7 +5758,7 @@ declare interface FilterOperators<TValue> extends NonObjectIdLikeDocument {
5746
5758
  $rand?: Record<string, never>;
5747
5759
  }
5748
5760
  declare type FindAndModifyMethodShellOptions = {
5749
- query: Document_2;
5761
+ query: MQLQuery;
5750
5762
  sort?: (FindOneAndDeleteOptions | FindOneAndReplaceOptions | FindOneAndUpdateOptions)['sort'];
5751
5763
  update?: Document_2 | Document_2[];
5752
5764
  remove?: boolean;
@@ -6661,6 +6673,7 @@ declare interface ModifyResult<TSchema = Document_2> {
6661
6673
  export declare class Mongo<M extends GenericServerSideSchema = GenericServerSideSchema> extends ShellApiClass {
6662
6674
  private __serviceProvider;
6663
6675
  readonly _databases: Record<StringKey<M>, DatabaseWithSchema<M>>;
6676
+ private _connectionId;
6664
6677
  _instanceState: ShellInstanceState;
6665
6678
  _connectionInfo: ConnectionInfo;
6666
6679
  private _explicitEncryptionOnly;
@@ -6691,6 +6704,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
6691
6704
  Returns the specified Collection of the Mongo object.
6692
6705
  */
6693
6706
  getCollection<KD extends StringKey<M>, KC extends StringKey<M[KD]>>(name: `${KD}.${KC}`): CollectionWithSchema<M, M[KD], M[KD][KC]>;
6707
+ _getConnectionId(): string;
6694
6708
  /*
6695
6709
  Returns the connection string for current session
6696
6710
  */
@@ -6792,7 +6806,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
6792
6806
  /*
6793
6807
  Opens a change stream cursor on the connection
6794
6808
  */
6795
- watch(pipeline?: Document_2[] | ChangeStreamOptions, options?: ChangeStreamOptions): ChangeStreamCursor;
6809
+ watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): ChangeStreamCursor;
6796
6810
  /*
6797
6811
  Returns the ClientEncryption object for the current database collection. The ClientEncryption object supports explicit (manual) encryption and decryption of field values for Client-Side field level encryption.
6798
6812
  */
@@ -7288,6 +7302,7 @@ declare interface MongoDBOIDCLogEventsMap {
7288
7302
  }) => void;
7289
7303
  'mongodb-oidc-plugin:state-updated': (event: {
7290
7304
  updateId: number;
7305
+ tokenSetId: string;
7291
7306
  timerDuration: number | undefined;
7292
7307
  }) => void;
7293
7308
  'mongodb-oidc-plugin:local-redirect-accessed': (event: {
@@ -7341,10 +7356,14 @@ declare interface MongoDBOIDCLogEventsMap {
7341
7356
  'mongodb-oidc-plugin:open-browser-complete': () => void;
7342
7357
  'mongodb-oidc-plugin:notify-device-flow': () => void;
7343
7358
  'mongodb-oidc-plugin:auth-attempt-started': (event: {
7359
+ authStateId: string;
7344
7360
  flow: string;
7345
7361
  }) => void;
7346
- 'mongodb-oidc-plugin:auth-attempt-succeeded': () => void;
7362
+ 'mongodb-oidc-plugin:auth-attempt-succeeded': (event: {
7363
+ authStateId: string;
7364
+ }) => void;
7347
7365
  'mongodb-oidc-plugin:auth-attempt-failed': (event: {
7366
+ authStateId: string;
7348
7367
  error: string;
7349
7368
  }) => void;
7350
7369
  'mongodb-oidc-plugin:refresh-skipped': (event: {
@@ -7366,12 +7385,15 @@ declare interface MongoDBOIDCLogEventsMap {
7366
7385
  refreshToken: string | null;
7367
7386
  }) => void;
7368
7387
  'mongodb-oidc-plugin:skip-auth-attempt': (event: {
7388
+ authStateId: string;
7369
7389
  reason: string;
7370
7390
  }) => void;
7371
7391
  'mongodb-oidc-plugin:auth-failed': (event: {
7392
+ authStateId: string;
7372
7393
  error: string;
7373
7394
  }) => void;
7374
7395
  'mongodb-oidc-plugin:auth-succeeded': (event: {
7396
+ authStateId: string;
7375
7397
  tokenType: string | null;
7376
7398
  refreshToken: string | null;
7377
7399
  expiresAt: string | null;
@@ -7381,6 +7403,30 @@ declare interface MongoDBOIDCLogEventsMap {
7381
7403
  idToken: string | undefined;
7382
7404
  refreshToken: string | undefined;
7383
7405
  };
7406
+ forceRefreshOrReauth: boolean;
7407
+ willRetryWithForceRefreshOrReauth: boolean;
7408
+ tokenSetId: string;
7409
+ }) => void;
7410
+ 'mongodb-oidc-plugin:request-token-started': (event: {
7411
+ authStateId: string;
7412
+ isCurrentAuthAttemptSet: boolean;
7413
+ tokenSetId: string | undefined;
7414
+ username: string | undefined;
7415
+ issuer: string;
7416
+ clientId: string;
7417
+ requestScopes: string[] | undefined;
7418
+ }) => void;
7419
+ 'mongodb-oidc-plugin:request-token-ended': (event: {
7420
+ authStateId: string;
7421
+ isCurrentAuthAttemptSet: boolean;
7422
+ tokenSetId: string | undefined;
7423
+ username: string | undefined;
7424
+ issuer: string;
7425
+ clientId: string;
7426
+ requestScopes: string[] | undefined;
7427
+ }) => void;
7428
+ 'mongodb-oidc-plugin:discarding-token-set': (event: {
7429
+ tokenSetId: string;
7384
7430
  }) => void;
7385
7431
  'mongodb-oidc-plugin:destroyed': () => void;
7386
7432
  'mongodb-oidc-plugin:missing-id-token': () => void;
@@ -7739,7 +7785,7 @@ declare interface MongoshBusEventsMap extends ConnectEventMap {
7739
7785
  'mongosh:crypt-library-load-found': (ev: CryptLibraryFoundEvent) => void;
7740
7786
  'mongosh:closed': () => void;
7741
7787
  'mongosh:eval-complete': () => void;
7742
- 'mongosh:autocompletion-complete': () => void;
7788
+ 'mongosh:autocompletion-complete': (replResults: string[], mongoshResults: string[]) => void;
7743
7789
  'mongosh:interrupt-complete': () => void;
7744
7790
  'mongosh-snippets:loaded': (ev: SnippetsLoadedEvent) => void;
7745
7791
  'mongosh-snippets:npm-lookup': (ev: SnippetsNpmLookupEvent) => void;
@@ -7763,6 +7809,9 @@ declare interface MongoshBusEventsMap extends ConnectEventMap {
7763
7809
  'mongosh:fetching-update-metadata-complete': (ev: FetchingUpdateMetadataCompleteEvent) => void;
7764
7810
  'mongosh:log-initialized': () => void;
7765
7811
  }
7812
+ declare type MQLDocument = Document_2;
7813
+ declare type MQLPipeline = Document_2[];
7814
+ declare type MQLQuery = Document_2;
7766
7815
  declare interface Namespace {
7767
7816
  db: string;
7768
7817
  collection: string;
@@ -7951,11 +8000,11 @@ declare class PlanCache extends ShellApiWithMongoClass {
7951
8000
  /*
7952
8001
  Removes cached query plan(s) for a collection of the specified query shape.
7953
8002
  */
7954
- clearPlansByQuery(query: Document_2, projection?: Document_2, sort?: Document_2): Document_2;
8003
+ clearPlansByQuery(query: MQLQuery, projection?: Document_2, sort?: Document_2): Document_2;
7955
8004
  /*
7956
8005
  Lists cached query plan(s) for a collection.
7957
8006
  */
7958
- list(pipeline?: Document_2[]): Document_2[];
8007
+ list(pipeline?: MQLPipeline): Document_2[];
7959
8008
  /*
7960
8009
  Deprecated. Please use PlanCache.list instead
7961
8010
  */
@@ -9005,15 +9054,15 @@ export declare class Shard<M extends GenericServerSideSchema = GenericServerSide
9005
9054
  /*
9006
9055
  Divides an existing chunk into two chunks using a specific value of the shard key as the dividing point. Uses the split command
9007
9056
  */
9008
- splitAt(ns: string, query: Document_2): Document_2;
9057
+ splitAt(ns: string, query: MQLQuery): Document_2;
9009
9058
  /*
9010
9059
  Splits a chunk at the shard key value specified by the query at the median. Uses the split command
9011
9060
  */
9012
- splitFind(ns: string, query: Document_2): Document_2;
9061
+ splitFind(ns: string, query: MQLQuery): Document_2;
9013
9062
  /*
9014
9063
  Moves the chunk that contains the document specified by the query to the destination shard. Uses the moveChunk command
9015
9064
  */
9016
- moveChunk(ns: string, query: Document_2, destination: string): Document_2;
9065
+ moveChunk(ns: string, query: MQLQuery, destination: string): Document_2;
9017
9066
  /*
9018
9067
  Moves a range of documents specified by the min and max keys to the destination shard. Uses the moveRange command
9019
9068
  */
@@ -9370,6 +9419,8 @@ declare class ShellInstanceState {
9370
9419
  emitApiCallWithArgs(event: ApiEventWithArguments): void;
9371
9420
  emitApiCall(event: Omit<ApiEvent, 'callDepth'>): void;
9372
9421
  setEvaluationListener(listener: EvaluationListener): void;
9422
+ getMongoByConnectionId(connectionId: string): Mongo;
9423
+ getAutocompletionContext(): AutocompletionContext;
9373
9424
  getAutocompleteParameters(): AutocompleteParameters;
9374
9425
  apiVersionInfo(): Required<ServerApi> | undefined;
9375
9426
  onInterruptExecution(): Promise<boolean>;
@@ -9531,7 +9582,7 @@ declare class StreamProcessor extends ShellApiWithMongoClass {
9531
9582
  /*
9532
9583
  Modify a stream processor definition.
9533
9584
  */
9534
- modify(pipeline: Document_2[], options?: Document_2): Document_2;
9585
+ modify(pipeline: MQLPipeline, options?: Document_2): Document_2;
9535
9586
  /*
9536
9587
  Return a sample of the results from a named stream processor.
9537
9588
  */
@@ -9551,11 +9602,11 @@ export declare class Streams<M extends GenericServerSideSchema = GenericServerSi
9551
9602
  /*
9552
9603
  Allows a user to process streams of data in the shell interactively and quickly iterate building a stream processor as they go.
9553
9604
  */
9554
- process(pipeline: Document_2[], options?: Document_2): void | Document_2;
9605
+ process(pipeline: MQLPipeline, options?: Document_2): void | Document_2;
9555
9606
  /*
9556
9607
  Create a named stream processor.
9557
9608
  */
9558
- createStreamProcessor(name: string, pipeline: Document_2[], options?: Document_2): Document_2 | StreamProcessor;
9609
+ createStreamProcessor(name: string, pipeline: MQLPipeline, options?: Document_2): Document_2 | StreamProcessor;
9559
9610
  /*
9560
9611
  Show a list of all the named stream processors.
9561
9612
  */