@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.
- package/lib/api-export.js +1 -1
- package/lib/api-processed.d.ts +109 -58
- package/lib/api-raw.d.ts +109 -58
- package/lib/bulk.d.ts +3 -2
- package/lib/bulk.js.map +1 -1
- package/lib/collection.d.ts +21 -13
- package/lib/collection.js +53 -1
- package/lib/collection.js.map +1 -1
- package/lib/cursor.d.ts +17 -17
- package/lib/database.d.ts +6 -5
- package/lib/database.js.map +1 -1
- package/lib/decorators.d.ts +6 -2
- package/lib/decorators.js +9 -2
- package/lib/decorators.js.map +1 -1
- package/lib/explainable-cursor.d.ts +1 -0
- package/lib/explainable-cursor.js +15 -7
- package/lib/explainable-cursor.js.map +1 -1
- package/lib/explainable.d.ts +10 -9
- package/lib/explainable.js.map +1 -1
- package/lib/helpers.d.ts +3 -2
- package/lib/helpers.js.map +1 -1
- package/lib/mongo.d.ts +4 -1
- package/lib/mongo.js +5 -0
- package/lib/mongo.js.map +1 -1
- package/lib/mongosh-version.d.ts +1 -1
- package/lib/mongosh-version.js +1 -1
- package/lib/mql-types.d.ts +4 -0
- package/lib/mql-types.js +3 -0
- package/lib/mql-types.js.map +1 -0
- package/lib/plan-cache.d.ts +3 -2
- package/lib/plan-cache.js.map +1 -1
- package/lib/shard.d.ts +4 -3
- package/lib/shard.js.map +1 -1
- package/lib/shell-api.js +29 -5
- package/lib/shell-api.js.map +1 -1
- package/lib/shell-instance-state.d.ts +3 -0
- package/lib/shell-instance-state.js +76 -0
- package/lib/shell-instance-state.js.map +1 -1
- package/lib/stream-processor.d.ts +2 -1
- package/lib/stream-processor.js.map +1 -1
- package/lib/streams.d.ts +3 -2
- package/lib/streams.js.map +1 -1
- package/package.json +8 -6
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 { 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';
|
|
@@ -1126,8 +1127,8 @@ declare class Bulk extends ShellApiWithMongoClass {
|
|
|
1126
1127
|
[asPrintable](): any;
|
|
1127
1128
|
private _emitBulkApiCall;
|
|
1128
1129
|
execute(writeConcern?: WriteConcern): Promise<BulkWriteResult_2>;
|
|
1129
|
-
find(query:
|
|
1130
|
-
insert(document:
|
|
1130
|
+
find(query: MQLQuery): BulkFindOp;
|
|
1131
|
+
insert(document: MQLDocument): Bulk;
|
|
1131
1132
|
toJSON(): Record<'nInsertOps' | 'nUpdateOps' | 'nRemoveOps' | 'nBatches', number>;
|
|
1132
1133
|
toString(): string;
|
|
1133
1134
|
getOperations(): Pick<Batch, 'originalZeroIndex' | 'batchType' | 'operations'>[];
|
|
@@ -2848,36 +2849,37 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
|
|
|
2848
2849
|
_mongo: Mongo<M>;
|
|
2849
2850
|
_database: DatabaseWithSchema<M, D>;
|
|
2850
2851
|
_name: N;
|
|
2852
|
+
_cachedSampleDocs: Document_2[];
|
|
2851
2853
|
constructor(mongo: Mongo<M>, database: DatabaseWithSchema<M, D> | Database<M, D>, name: N);
|
|
2852
2854
|
[namespaceInfo](): Namespace;
|
|
2853
2855
|
[asPrintable](): string;
|
|
2854
2856
|
private _emitCollectionApiCall;
|
|
2855
|
-
aggregate(pipeline:
|
|
2857
|
+
aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
|
|
2856
2858
|
explain: ExplainVerbosityLike;
|
|
2857
2859
|
}): Promise<Document_2>;
|
|
2858
|
-
aggregate(pipeline:
|
|
2859
|
-
aggregate(...stages:
|
|
2860
|
+
aggregate(pipeline: MQLPipeline, options?: AggregateOptions): Promise<AggregationCursor_2>;
|
|
2861
|
+
aggregate(...stages: MQLPipeline): Promise<AggregationCursor_2>;
|
|
2860
2862
|
bulkWrite(operations: AnyBulkWriteOperation[], options?: BulkWriteOptions): Promise<BulkWriteResult_2>;
|
|
2861
2863
|
count(query?: {}, options?: CountOptions): Promise<number>;
|
|
2862
|
-
countDocuments(query?:
|
|
2864
|
+
countDocuments(query?: MQLQuery, options?: CountDocumentsOptions): Promise<number>;
|
|
2863
2865
|
deleteMany(filter: Document_2, options?: DeleteOptions): Promise<DeleteResult_2 | Document_2>;
|
|
2864
2866
|
deleteOne(filter: Document_2, options?: DeleteOptions): Promise<DeleteResult_2 | Document_2>;
|
|
2865
2867
|
distinct(field: string): Promise<Document_2>;
|
|
2866
|
-
distinct(field: string, query:
|
|
2867
|
-
distinct(field: string, query:
|
|
2868
|
+
distinct(field: string, query: MQLQuery): Promise<Document_2>;
|
|
2869
|
+
distinct(field: string, query: MQLQuery, options: DistinctOptions): Promise<Document_2>;
|
|
2868
2870
|
estimatedDocumentCount(options?: EstimatedDocumentCountOptions): Promise<number>;
|
|
2869
|
-
find(query?:
|
|
2871
|
+
find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Promise<Cursor>;
|
|
2870
2872
|
findAndModify(options: FindAndModifyMethodShellOptions): Promise<Document_2 | null>;
|
|
2871
|
-
findOne(query?:
|
|
2873
|
+
findOne(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Promise<MQLDocument | null>;
|
|
2872
2874
|
renameCollection(newName: string, dropTarget?: boolean): Promise<Document_2>;
|
|
2873
2875
|
findOneAndDelete(filter: Document_2, options?: FindOneAndDeleteOptions): Promise<Document_2 | null>;
|
|
2874
2876
|
findOneAndReplace(filter: Document_2, replacement: Document_2, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Promise<Document_2>;
|
|
2875
2877
|
findOneAndUpdate(filter: Document_2, update: Document_2 | Document_2[], options?: FindAndModifyShellOptions<FindOneAndUpdateOptions>): Promise<Document_2>;
|
|
2876
|
-
insert(docs:
|
|
2877
|
-
insertMany(docs:
|
|
2878
|
-
insertOne(doc:
|
|
2878
|
+
insert(docs: MQLDocument | MQLDocument[], options?: BulkWriteOptions): Promise<InsertManyResult_2>;
|
|
2879
|
+
insertMany(docs: MQLDocument[], options?: BulkWriteOptions): Promise<InsertManyResult_2>;
|
|
2880
|
+
insertOne(doc: MQLDocument, options?: InsertOneOptions): Promise<InsertOneResult_2>;
|
|
2879
2881
|
isCapped(): Promise<boolean>;
|
|
2880
|
-
remove(query:
|
|
2882
|
+
remove(query: MQLQuery, options?: boolean | RemoveShellOptions): Promise<DeleteResult_2 | Document_2>;
|
|
2881
2883
|
replaceOne(filter: Document_2, replacement: Document_2, options?: ReplaceOptions): Promise<UpdateResult_2>;
|
|
2882
2884
|
update(filter: Document_2, update: Document_2, options?: UpdateOptions & {
|
|
2883
2885
|
multi?: boolean;
|
|
@@ -2923,7 +2925,11 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
|
|
|
2923
2925
|
getShardVersion(): Promise<Document_2>;
|
|
2924
2926
|
_getShardedCollectionInfo(config: DatabaseWithSchema<M, D>, collStats: Document_2[]): Promise<Document_2>;
|
|
2925
2927
|
getShardDistribution(): Promise<CommandResult<GetShardDistributionResult>>;
|
|
2926
|
-
|
|
2928
|
+
getShardLocation(): Promise<{
|
|
2929
|
+
shards: string[];
|
|
2930
|
+
sharded: boolean;
|
|
2931
|
+
}>;
|
|
2932
|
+
watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): Promise<ChangeStreamCursor>;
|
|
2927
2933
|
hideIndex(index: string | Document_2): Promise<Document_2>;
|
|
2928
2934
|
unhideIndex(index: string | Document_2): Promise<Document_2>;
|
|
2929
2935
|
analyzeShardKey(key: Document_2, options?: Document_2): Promise<Document_2>;
|
|
@@ -2937,6 +2943,8 @@ declare class Collection<M extends GenericServerSideSchema = GenericServerSideSc
|
|
|
2937
2943
|
createSearchIndexes(specs: SearchIndexDescription[]): Promise<string[]>;
|
|
2938
2944
|
dropSearchIndex(indexName: string): Promise<void>;
|
|
2939
2945
|
updateSearchIndex(indexName: string, definition: Document_2): Promise<void>;
|
|
2946
|
+
_getSampleDocs(): Promise<Document_2[]>;
|
|
2947
|
+
_getSampleDocsForCompletion(): Promise<Document_2[]>;
|
|
2940
2948
|
}
|
|
2941
2949
|
|
|
2942
2950
|
/**
|
|
@@ -4238,30 +4246,30 @@ declare class Cursor extends AggregateOrFindCursor<ServiceProviderFindCursor> {
|
|
|
4238
4246
|
constructor(mongo: Mongo, cursor: ServiceProviderFindCursor);
|
|
4239
4247
|
toJSON(): void;
|
|
4240
4248
|
private _addFlag;
|
|
4241
|
-
addOption(optionFlagNumber: number):
|
|
4242
|
-
allowDiskUse(allow?: boolean):
|
|
4243
|
-
allowPartialResults():
|
|
4244
|
-
collation(spec: CollationOptions):
|
|
4245
|
-
comment(cmt: string):
|
|
4249
|
+
addOption(optionFlagNumber: number): this;
|
|
4250
|
+
allowDiskUse(allow?: boolean): this;
|
|
4251
|
+
allowPartialResults(): this;
|
|
4252
|
+
collation(spec: CollationOptions): this;
|
|
4253
|
+
comment(cmt: string): this;
|
|
4246
4254
|
count(): Promise<number>;
|
|
4247
4255
|
hasNext(): Promise<boolean>;
|
|
4248
|
-
hint(index: string):
|
|
4249
|
-
limit(value: number):
|
|
4250
|
-
max(indexBounds: Document_2):
|
|
4251
|
-
maxAwaitTimeMS(value: number):
|
|
4252
|
-
min(indexBounds: Document_2):
|
|
4256
|
+
hint(index: string): this;
|
|
4257
|
+
limit(value: number): this;
|
|
4258
|
+
max(indexBounds: Document_2): this;
|
|
4259
|
+
maxAwaitTimeMS(value: number): this;
|
|
4260
|
+
min(indexBounds: Document_2): this;
|
|
4253
4261
|
next(): Promise<Document_2 | null>;
|
|
4254
|
-
noCursorTimeout():
|
|
4255
|
-
oplogReplay():
|
|
4256
|
-
readPref(mode: ReadPreferenceLike, tagSet?: TagSet[], hedgeOptions?: HedgeOptions):
|
|
4257
|
-
returnKey(enabled: boolean):
|
|
4262
|
+
noCursorTimeout(): this;
|
|
4263
|
+
oplogReplay(): this;
|
|
4264
|
+
readPref(mode: ReadPreferenceLike, tagSet?: TagSet[], hedgeOptions?: HedgeOptions): this;
|
|
4265
|
+
returnKey(enabled: boolean): this;
|
|
4258
4266
|
size(): Promise<number>;
|
|
4259
4267
|
tailable(opts?: {
|
|
4260
4268
|
awaitData: boolean;
|
|
4261
|
-
}):
|
|
4269
|
+
}): this;
|
|
4262
4270
|
maxScan(): void;
|
|
4263
|
-
showRecordId():
|
|
4264
|
-
readConcern(level: ReadConcernLevel):
|
|
4271
|
+
showRecordId(): this;
|
|
4272
|
+
readConcern(level: ReadConcernLevel): this;
|
|
4265
4273
|
}
|
|
4266
4274
|
|
|
4267
4275
|
/** @public */
|
|
@@ -4351,11 +4359,11 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
|
|
|
4351
4359
|
getCollectionInfos(filter?: Document_2, options?: ListCollectionsOptions): Promise<Document_2[]>;
|
|
4352
4360
|
runCommand(cmd: string | Document_2, options?: RunCommandOptions): Promise<Document_2>;
|
|
4353
4361
|
adminCommand(cmd: string | Document_2): Promise<Document_2>;
|
|
4354
|
-
aggregate(pipeline:
|
|
4362
|
+
aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
|
|
4355
4363
|
explain: ExplainVerbosityLike;
|
|
4356
4364
|
}): Promise<Document_2>;
|
|
4357
|
-
aggregate(pipeline:
|
|
4358
|
-
aggregate(...stages:
|
|
4365
|
+
aggregate(pipeline: MQLPipeline, options?: AggregateOptions): Promise<AggregationCursor_2>;
|
|
4366
|
+
aggregate(...stages: MQLPipeline): Promise<AggregationCursor_2>;
|
|
4359
4367
|
getSiblingDB<K extends StringKey<M>>(db: K): DatabaseWithSchema<M, M[K]>;
|
|
4360
4368
|
getCollection<K extends StringKey<D>>(coll: K): CollectionWithSchema<M, D, D[K], K>;
|
|
4361
4369
|
dropDatabase(writeConcern?: WriteConcern): Promise<Document_2>;
|
|
@@ -4379,7 +4387,7 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
|
|
|
4379
4387
|
collection: Collection;
|
|
4380
4388
|
encryptedFields: Document_2;
|
|
4381
4389
|
}>;
|
|
4382
|
-
createView(name: string, source: string, pipeline:
|
|
4390
|
+
createView(name: string, source: string, pipeline: MQLPipeline, options?: CreateCollectionOptions): Promise<{
|
|
4383
4391
|
ok: number;
|
|
4384
4392
|
}>;
|
|
4385
4393
|
createRole(role: Document_2, writeConcern?: WriteConcern): Promise<Document_2>;
|
|
@@ -4426,7 +4434,7 @@ declare class Database<M extends GenericServerSideSchema = GenericServerSideSche
|
|
|
4426
4434
|
printReplicationInfo(): Promise<CommandResult>;
|
|
4427
4435
|
printSlaveReplicationInfo(): never;
|
|
4428
4436
|
setSecondaryOk(): Promise<void>;
|
|
4429
|
-
watch(pipeline?:
|
|
4437
|
+
watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): Promise<ChangeStreamCursor>;
|
|
4430
4438
|
sql(sqlString: string, options?: AggregateOptions): Promise<AggregationCursor_2>;
|
|
4431
4439
|
checkMetadataConsistency(options?: CheckMetadataConsistencyOptions): Promise<RunCommandCursor_2>;
|
|
4432
4440
|
}
|
|
@@ -4981,18 +4989,18 @@ declare class Explainable extends ShellApiWithMongoClass {
|
|
|
4981
4989
|
getCollection(): CollectionWithSchema;
|
|
4982
4990
|
getVerbosity(): ExplainVerbosityLike;
|
|
4983
4991
|
setVerbosity(verbosity: ExplainVerbosityLike): void;
|
|
4984
|
-
find(query?:
|
|
4985
|
-
aggregate(pipeline:
|
|
4986
|
-
aggregate(...stages:
|
|
4992
|
+
find(query?: MQLQuery, projection?: Document_2, options?: FindOptions): Promise<ExplainableCursor_2>;
|
|
4993
|
+
aggregate(pipeline: MQLPipeline, options: Document_2): Promise<Document_2>;
|
|
4994
|
+
aggregate(...stages: MQLPipeline): Promise<Document_2>;
|
|
4987
4995
|
count(query?: {}, options?: CountOptions): Promise<Document_2>;
|
|
4988
4996
|
distinct(field: string): Promise<Document_2>;
|
|
4989
|
-
distinct(field: string, query:
|
|
4990
|
-
distinct(field: string, query:
|
|
4997
|
+
distinct(field: string, query: MQLQuery): Promise<Document_2>;
|
|
4998
|
+
distinct(field: string, query: MQLQuery, options: DistinctOptions): Promise<Document_2>;
|
|
4991
4999
|
findAndModify(options: FindAndModifyMethodShellOptions): Promise<Document_2 | null>;
|
|
4992
|
-
findOneAndDelete(filter:
|
|
4993
|
-
findOneAndReplace(filter:
|
|
4994
|
-
findOneAndUpdate(filter:
|
|
4995
|
-
remove(query:
|
|
5000
|
+
findOneAndDelete(filter: MQLQuery, options?: FindOneAndDeleteOptions): Promise<Document_2 | null>;
|
|
5001
|
+
findOneAndReplace(filter: MQLQuery, replacement: MQLDocument, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Promise<Document_2>;
|
|
5002
|
+
findOneAndUpdate(filter: MQLQuery, update: MQLDocument, options?: FindAndModifyShellOptions<FindOneAndUpdateOptions>): Promise<Document_2>;
|
|
5003
|
+
remove(query: MQLQuery, options?: boolean | RemoveShellOptions): Promise<Document_2>;
|
|
4996
5004
|
update(filter: Document_2, update: Document_2, options?: UpdateOptions): Promise<Document_2>;
|
|
4997
5005
|
mapReduce(map: Function | string, reduce: Function | string, optionsOrOutString: MapReduceShellOptions): Promise<Document_2>;
|
|
4998
5006
|
}
|
|
@@ -5035,6 +5043,7 @@ declare class ExplainableCursor_2 extends Cursor {
|
|
|
5035
5043
|
_explained: any;
|
|
5036
5044
|
constructor(mongo: Mongo, cursor: Cursor, verbosity: ExplainVerbosityLike);
|
|
5037
5045
|
[asPrintable](): Promise<any>;
|
|
5046
|
+
finish(): Promise<any>;
|
|
5038
5047
|
}
|
|
5039
5048
|
|
|
5040
5049
|
/** @public */
|
|
@@ -5159,7 +5168,7 @@ declare interface FilterOperators<TValue> extends NonObjectIdLikeDocument {
|
|
|
5159
5168
|
}
|
|
5160
5169
|
|
|
5161
5170
|
declare type FindAndModifyMethodShellOptions = {
|
|
5162
|
-
query:
|
|
5171
|
+
query: MQLQuery;
|
|
5163
5172
|
sort?: (FindOneAndDeleteOptions | FindOneAndReplaceOptions | FindOneAndUpdateOptions)['sort'];
|
|
5164
5173
|
update?: Document_2 | Document_2[];
|
|
5165
5174
|
remove?: boolean;
|
|
@@ -6060,6 +6069,7 @@ declare interface ModifyResult<TSchema = Document_2> {
|
|
|
6060
6069
|
export declare class Mongo<M extends GenericServerSideSchema = GenericServerSideSchema> extends ShellApiClass {
|
|
6061
6070
|
private __serviceProvider;
|
|
6062
6071
|
readonly _databases: Record<StringKey<M>, DatabaseWithSchema<M>>;
|
|
6072
|
+
private _connectionId;
|
|
6063
6073
|
_instanceState: ShellInstanceState;
|
|
6064
6074
|
_connectionInfo: ConnectionInfo;
|
|
6065
6075
|
private _explicitEncryptionOnly;
|
|
@@ -6081,6 +6091,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
|
|
|
6081
6091
|
_getDb<K extends StringKey<M>>(name: K): DatabaseWithSchema<M, M[K]>;
|
|
6082
6092
|
getDB<K extends StringKey<M>>(db: K): DatabaseWithSchema<M, M[K]>;
|
|
6083
6093
|
getCollection<KD extends StringKey<M>, KC extends StringKey<M[KD]>>(name: `${KD}.${KC}`): CollectionWithSchema<M, M[KD], M[KD][KC]>;
|
|
6094
|
+
_getConnectionId(): string;
|
|
6084
6095
|
getURI(): string;
|
|
6085
6096
|
use(db: StringKey<M>): string;
|
|
6086
6097
|
_listDatabases(opts?: ListDatabasesOptions): Promise<{
|
|
@@ -6122,7 +6133,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
|
|
|
6122
6133
|
isCausalConsistency(): void;
|
|
6123
6134
|
setSlaveOk(): void;
|
|
6124
6135
|
setSecondaryOk(): Promise<void>;
|
|
6125
|
-
watch(pipeline?:
|
|
6136
|
+
watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): Promise<ChangeStreamCursor>;
|
|
6126
6137
|
getClientEncryption(): ClientEncryption_2;
|
|
6127
6138
|
getKeyVault(): Promise<KeyVault>;
|
|
6128
6139
|
convertShardKeyToHashed(value: any): Promise<unknown>;
|
|
@@ -6609,6 +6620,7 @@ declare interface MongoDBOIDCLogEventsMap {
|
|
|
6609
6620
|
}) => void;
|
|
6610
6621
|
'mongodb-oidc-plugin:state-updated': (event: {
|
|
6611
6622
|
updateId: number;
|
|
6623
|
+
tokenSetId: string;
|
|
6612
6624
|
timerDuration: number | undefined;
|
|
6613
6625
|
}) => void;
|
|
6614
6626
|
'mongodb-oidc-plugin:local-redirect-accessed': (event: {
|
|
@@ -6662,10 +6674,14 @@ declare interface MongoDBOIDCLogEventsMap {
|
|
|
6662
6674
|
'mongodb-oidc-plugin:open-browser-complete': () => void;
|
|
6663
6675
|
'mongodb-oidc-plugin:notify-device-flow': () => void;
|
|
6664
6676
|
'mongodb-oidc-plugin:auth-attempt-started': (event: {
|
|
6677
|
+
authStateId: string;
|
|
6665
6678
|
flow: string;
|
|
6666
6679
|
}) => void;
|
|
6667
|
-
'mongodb-oidc-plugin:auth-attempt-succeeded': (
|
|
6680
|
+
'mongodb-oidc-plugin:auth-attempt-succeeded': (event: {
|
|
6681
|
+
authStateId: string;
|
|
6682
|
+
}) => void;
|
|
6668
6683
|
'mongodb-oidc-plugin:auth-attempt-failed': (event: {
|
|
6684
|
+
authStateId: string;
|
|
6669
6685
|
error: string;
|
|
6670
6686
|
}) => void;
|
|
6671
6687
|
'mongodb-oidc-plugin:refresh-skipped': (event: {
|
|
@@ -6687,12 +6703,15 @@ declare interface MongoDBOIDCLogEventsMap {
|
|
|
6687
6703
|
refreshToken: string | null;
|
|
6688
6704
|
}) => void;
|
|
6689
6705
|
'mongodb-oidc-plugin:skip-auth-attempt': (event: {
|
|
6706
|
+
authStateId: string;
|
|
6690
6707
|
reason: string;
|
|
6691
6708
|
}) => void;
|
|
6692
6709
|
'mongodb-oidc-plugin:auth-failed': (event: {
|
|
6710
|
+
authStateId: string;
|
|
6693
6711
|
error: string;
|
|
6694
6712
|
}) => void;
|
|
6695
6713
|
'mongodb-oidc-plugin:auth-succeeded': (event: {
|
|
6714
|
+
authStateId: string;
|
|
6696
6715
|
tokenType: string | null;
|
|
6697
6716
|
refreshToken: string | null;
|
|
6698
6717
|
expiresAt: string | null;
|
|
@@ -6702,6 +6721,30 @@ declare interface MongoDBOIDCLogEventsMap {
|
|
|
6702
6721
|
idToken: string | undefined;
|
|
6703
6722
|
refreshToken: string | undefined;
|
|
6704
6723
|
};
|
|
6724
|
+
forceRefreshOrReauth: boolean;
|
|
6725
|
+
willRetryWithForceRefreshOrReauth: boolean;
|
|
6726
|
+
tokenSetId: string;
|
|
6727
|
+
}) => void;
|
|
6728
|
+
'mongodb-oidc-plugin:request-token-started': (event: {
|
|
6729
|
+
authStateId: string;
|
|
6730
|
+
isCurrentAuthAttemptSet: boolean;
|
|
6731
|
+
tokenSetId: string | undefined;
|
|
6732
|
+
username: string | undefined;
|
|
6733
|
+
issuer: string;
|
|
6734
|
+
clientId: string;
|
|
6735
|
+
requestScopes: string[] | undefined;
|
|
6736
|
+
}) => void;
|
|
6737
|
+
'mongodb-oidc-plugin:request-token-ended': (event: {
|
|
6738
|
+
authStateId: string;
|
|
6739
|
+
isCurrentAuthAttemptSet: boolean;
|
|
6740
|
+
tokenSetId: string | undefined;
|
|
6741
|
+
username: string | undefined;
|
|
6742
|
+
issuer: string;
|
|
6743
|
+
clientId: string;
|
|
6744
|
+
requestScopes: string[] | undefined;
|
|
6745
|
+
}) => void;
|
|
6746
|
+
'mongodb-oidc-plugin:discarding-token-set': (event: {
|
|
6747
|
+
tokenSetId: string;
|
|
6705
6748
|
}) => void;
|
|
6706
6749
|
'mongodb-oidc-plugin:destroyed': () => void;
|
|
6707
6750
|
'mongodb-oidc-plugin:missing-id-token': () => void;
|
|
@@ -7062,7 +7105,7 @@ declare interface MongoshBusEventsMap extends ConnectEventMap {
|
|
|
7062
7105
|
'mongosh:crypt-library-load-found': (ev: CryptLibraryFoundEvent) => void;
|
|
7063
7106
|
'mongosh:closed': () => void;
|
|
7064
7107
|
'mongosh:eval-complete': () => void;
|
|
7065
|
-
'mongosh:autocompletion-complete': () => void;
|
|
7108
|
+
'mongosh:autocompletion-complete': (replResults: string[], mongoshResults: string[]) => void;
|
|
7066
7109
|
'mongosh:interrupt-complete': () => void;
|
|
7067
7110
|
'mongosh-snippets:loaded': (ev: SnippetsLoadedEvent) => void;
|
|
7068
7111
|
'mongosh-snippets:npm-lookup': (ev: SnippetsNpmLookupEvent) => void;
|
|
@@ -7087,6 +7130,12 @@ declare interface MongoshBusEventsMap extends ConnectEventMap {
|
|
|
7087
7130
|
'mongosh:log-initialized': () => void;
|
|
7088
7131
|
}
|
|
7089
7132
|
|
|
7133
|
+
declare type MQLDocument = Document_2;
|
|
7134
|
+
|
|
7135
|
+
declare type MQLPipeline = Document_2[];
|
|
7136
|
+
|
|
7137
|
+
declare type MQLQuery = Document_2;
|
|
7138
|
+
|
|
7090
7139
|
declare interface Namespace {
|
|
7091
7140
|
db: string;
|
|
7092
7141
|
collection: string;
|
|
@@ -7276,8 +7325,8 @@ declare class PlanCache extends ShellApiWithMongoClass {
|
|
|
7276
7325
|
get _mongo(): Mongo;
|
|
7277
7326
|
[asPrintable](): string;
|
|
7278
7327
|
clear(): Promise<Document_2>;
|
|
7279
|
-
clearPlansByQuery(query:
|
|
7280
|
-
list(pipeline?:
|
|
7328
|
+
clearPlansByQuery(query: MQLQuery, projection?: Document_2, sort?: Document_2): Promise<Document_2>;
|
|
7329
|
+
list(pipeline?: MQLPipeline): Promise<Document_2[]>;
|
|
7281
7330
|
listQueryShapes(): never;
|
|
7282
7331
|
getPlansByQuery(): never;
|
|
7283
7332
|
}
|
|
@@ -8205,9 +8254,9 @@ export declare class Shard<M extends GenericServerSideSchema = GenericServerSide
|
|
|
8205
8254
|
removeShardTag(shard: string, tag: string): Promise<Document_2>;
|
|
8206
8255
|
enableAutoSplit(): Promise<UpdateResult_2>;
|
|
8207
8256
|
disableAutoSplit(): Promise<UpdateResult_2>;
|
|
8208
|
-
splitAt(ns: string, query:
|
|
8209
|
-
splitFind(ns: string, query:
|
|
8210
|
-
moveChunk(ns: string, query:
|
|
8257
|
+
splitAt(ns: string, query: MQLQuery): Promise<Document_2>;
|
|
8258
|
+
splitFind(ns: string, query: MQLQuery): Promise<Document_2>;
|
|
8259
|
+
moveChunk(ns: string, query: MQLQuery, destination: string): Promise<Document_2>;
|
|
8211
8260
|
moveRange(ns: string, toShard: string, min?: Document_2, max?: Document_2): Promise<Document_2>;
|
|
8212
8261
|
balancerCollectionStatus(ns: string): Promise<Document_2>;
|
|
8213
8262
|
enableBalancing(ns: string): Promise<UpdateResult_2>;
|
|
@@ -8435,6 +8484,8 @@ declare class ShellInstanceState {
|
|
|
8435
8484
|
emitApiCallWithArgs(event: ApiEventWithArguments): void;
|
|
8436
8485
|
emitApiCall(event: Omit<ApiEvent, 'callDepth'>): void;
|
|
8437
8486
|
setEvaluationListener(listener: EvaluationListener): void;
|
|
8487
|
+
getMongoByConnectionId(connectionId: string): Mongo;
|
|
8488
|
+
getAutocompletionContext(): AutocompletionContext;
|
|
8438
8489
|
getAutocompleteParameters(): AutocompleteParameters;
|
|
8439
8490
|
apiVersionInfo(): Required<ServerApi> | undefined;
|
|
8440
8491
|
onInterruptExecution(): Promise<boolean>;
|
|
@@ -8580,7 +8631,7 @@ declare class StreamProcessor extends ShellApiWithMongoClass {
|
|
|
8580
8631
|
_drop(options?: Document_2): Promise<Document_2>;
|
|
8581
8632
|
stats(options?: Document_2): Promise<Document_2>;
|
|
8582
8633
|
modify(options: Document_2): Promise<Document_2>;
|
|
8583
|
-
modify(pipeline:
|
|
8634
|
+
modify(pipeline: MQLPipeline, options?: Document_2): Promise<Document_2>;
|
|
8584
8635
|
sample(options?: Document_2): Promise<Document_2 | undefined>;
|
|
8585
8636
|
_sampleFrom(cursorId: number): Promise<Document_2 | undefined>;
|
|
8586
8637
|
}
|
|
@@ -8592,8 +8643,8 @@ export declare class Streams<M extends GenericServerSideSchema = GenericServerSi
|
|
|
8592
8643
|
get _mongo(): Mongo<M>;
|
|
8593
8644
|
[asPrintable](): string;
|
|
8594
8645
|
getProcessor(name: string): StreamProcessor;
|
|
8595
|
-
process(pipeline:
|
|
8596
|
-
createStreamProcessor(name: string, pipeline:
|
|
8646
|
+
process(pipeline: MQLPipeline, options?: Document_2): Promise<void | Document_2>;
|
|
8647
|
+
createStreamProcessor(name: string, pipeline: MQLPipeline, options?: Document_2): Promise<Document_2 | StreamProcessor>;
|
|
8597
8648
|
listStreamProcessors(filter: Document_2): Promise<any>;
|
|
8598
8649
|
listConnections(filter: Document_2): Promise<any>;
|
|
8599
8650
|
_runStreamCommand(cmd: Document_2, options?: Document_2): Promise<Document_2>;
|
package/lib/bulk.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Batch, Document, WriteConcern, OrderedBulkOperation, UnorderedBulk
|
|
|
4
4
|
import { asPrintable } from './enums';
|
|
5
5
|
import { BulkWriteResult } from './result';
|
|
6
6
|
import type { CollectionWithSchema } from './collection';
|
|
7
|
+
import type { MQLDocument, MQLQuery } from './mql-types';
|
|
7
8
|
export declare class BulkFindOp extends ShellApiWithMongoClass {
|
|
8
9
|
_serviceProviderBulkFindOp: FindOperators;
|
|
9
10
|
_parentBulk: Bulk;
|
|
@@ -33,8 +34,8 @@ export default class Bulk extends ShellApiWithMongoClass {
|
|
|
33
34
|
[asPrintable](): any;
|
|
34
35
|
private _emitBulkApiCall;
|
|
35
36
|
execute(writeConcern?: WriteConcern): Promise<BulkWriteResult>;
|
|
36
|
-
find(query:
|
|
37
|
-
insert(document:
|
|
37
|
+
find(query: MQLQuery): BulkFindOp;
|
|
38
|
+
insert(document: MQLDocument): Bulk;
|
|
38
39
|
toJSON(): Record<'nInsertOps' | 'nUpdateOps' | 'nRemoveOps' | 'nBatches', number>;
|
|
39
40
|
toString(): string;
|
|
40
41
|
getOperations(): Pick<Batch, 'originalZeroIndex' | 'batchType' | 'operations'>[];
|
package/lib/bulk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.js","sourceRoot":"","sources":["../src/bulk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAOsB;AAEtB,4CAAyE;AAUzE,mCAAsC;AACtC,uCAAgE;AAChE,qCAA2C;
|
|
1
|
+
{"version":3,"file":"bulk.js","sourceRoot":"","sources":["../src/bulk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAOsB;AAEtB,4CAAyE;AAUzE,mCAAsC;AACtC,uCAAgE;AAChE,qCAA2C;IAK9B,UAAU;4BADtB,iCAAoB;;;;sBACW,mCAAsB;;;;;;;;;;;;;uCAA9B,SAAQ,WAAsB;QAGpD,YAAY,SAAwB,EAAE,UAAgB;YACpD,KAAK,EAAE,CAAC;YAHV,+BAA0B,GADf,mDAAU,CACqB;YAIxC,IAAI,CAAC,0BAA0B,GAAG,SAAS,CAAC;YAC5C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAChC,CAAC;QAED,IAAI,MAAM;YACR,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;QACjC,CAAC;QAED,CAAC,mBAAW,CAAC;YACX,OAAO,YAAY,CAAC;QACtB,CAAC;QAID,SAAS,CAAC,IAAsB;YAC9B,IAAI,CAAC,0BAA0B,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC;QACd,CAAC;QAID,YAAY,CAAC,OAAmB;YAC9B,IAAI,CAAC,0BAA0B,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC;QACd,CAAC;QAID,IAAI,CAAC,OAAiB;YACpB,IAAA,+BAAqB,EAAC,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAA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IJ,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC;YAE3D,OAAO;gBACL,GAAG,IAAI,CAAC,YAAY;gBACpB,QAAQ,EAAE,OAAO;aAClB,CAAC;QACJ,CAAC;QAED,QAAQ;YACN,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,aAAa;YAIX,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,MAAM,IAAI,iCAAwB,CAChC,2DAA2D,EAC3D,qBAAY,CAAC,gBAAgB,CAC9B,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrD,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;gBACtC,SAAS,EAAE,CAAC,CAAC,SAAS;gBACtB,UAAU,EAAE,CAAC,CAAC,UAAU;aACzB,CAAC,CAAC,CAAC;QACN,CAAC;;;;;;+BAjEA,2BAAc,EACd,IAAA,wBAAW,EAAC,CAAC,CAAC,CAAC,CAAC;4BAiBhB,IAAA,uBAAU,EAAC,YAAY,CAAC,EACxB,IAAA,wBAAW,EAAC,CAAC,CAAC,CAAC,CAAC;8BAMhB,IAAA,uBAAU,EAAC,MAAM,CAAC,EAClB,IAAA,wBAAW,EAAC,CAAC,CAAC,CAAC,CAAC;QAxBjB,8KAAM,OAAO,6DAcZ;QAID,qKAAA,IAAI,6DAGH;QAID,2KAAA,MAAM,6DAKL;QArFH,6KAuHC;;;QAvHoB,uDAAI"}
|
package/lib/collection.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { AggregationCursor, BulkWriteResult, CommandResult, Cursor, DeleteResult
|
|
|
9
9
|
import Bulk from './bulk';
|
|
10
10
|
import PlanCache from './plan-cache';
|
|
11
11
|
import ChangeStreamCursor from './change-stream-cursor';
|
|
12
|
+
import type { MQLDocument, MQLQuery, MQLPipeline } from './mql-types';
|
|
12
13
|
export type CollectionWithSchema<M extends GenericServerSideSchema = GenericServerSideSchema, D extends GenericDatabaseSchema = M[keyof M], C extends GenericCollectionSchema = D[keyof D], N extends StringKey<D> = StringKey<D>> = Collection<M, D, C, N> & {
|
|
13
14
|
[k in StringKey<D> as k extends `${N}.${infer S}` ? S : never]: Collection<M, D, D[k], k>;
|
|
14
15
|
};
|
|
@@ -16,36 +17,37 @@ export declare class Collection<M extends GenericServerSideSchema = GenericServe
|
|
|
16
17
|
_mongo: Mongo<M>;
|
|
17
18
|
_database: DatabaseWithSchema<M, D>;
|
|
18
19
|
_name: N;
|
|
20
|
+
_cachedSampleDocs: Document[];
|
|
19
21
|
constructor(mongo: Mongo<M>, database: DatabaseWithSchema<M, D> | Database<M, D>, name: N);
|
|
20
22
|
[namespaceInfo](): Namespace;
|
|
21
23
|
[asPrintable](): string;
|
|
22
24
|
private _emitCollectionApiCall;
|
|
23
|
-
aggregate(pipeline:
|
|
25
|
+
aggregate(pipeline: MQLPipeline, options: AggregateOptions & {
|
|
24
26
|
explain: ExplainVerbosityLike;
|
|
25
27
|
}): Promise<Document>;
|
|
26
|
-
aggregate(pipeline:
|
|
27
|
-
aggregate(...stages:
|
|
28
|
+
aggregate(pipeline: MQLPipeline, options?: AggregateOptions): Promise<AggregationCursor>;
|
|
29
|
+
aggregate(...stages: MQLPipeline): Promise<AggregationCursor>;
|
|
28
30
|
bulkWrite(operations: AnyBulkWriteOperation[], options?: BulkWriteOptions): Promise<BulkWriteResult>;
|
|
29
31
|
count(query?: {}, options?: CountOptions): Promise<number>;
|
|
30
|
-
countDocuments(query?:
|
|
32
|
+
countDocuments(query?: MQLQuery, options?: CountDocumentsOptions): Promise<number>;
|
|
31
33
|
deleteMany(filter: Document, options?: DeleteOptions): Promise<DeleteResult | Document>;
|
|
32
34
|
deleteOne(filter: Document, options?: DeleteOptions): Promise<DeleteResult | Document>;
|
|
33
35
|
distinct(field: string): Promise<Document>;
|
|
34
|
-
distinct(field: string, query:
|
|
35
|
-
distinct(field: string, query:
|
|
36
|
+
distinct(field: string, query: MQLQuery): Promise<Document>;
|
|
37
|
+
distinct(field: string, query: MQLQuery, options: DistinctOptions): Promise<Document>;
|
|
36
38
|
estimatedDocumentCount(options?: EstimatedDocumentCountOptions): Promise<number>;
|
|
37
|
-
find(query?:
|
|
39
|
+
find(query?: MQLQuery, projection?: Document, options?: FindOptions): Promise<Cursor>;
|
|
38
40
|
findAndModify(options: FindAndModifyMethodShellOptions): Promise<Document | null>;
|
|
39
|
-
findOne(query?:
|
|
41
|
+
findOne(query?: MQLQuery, projection?: Document, options?: FindOptions): Promise<MQLDocument | null>;
|
|
40
42
|
renameCollection(newName: string, dropTarget?: boolean): Promise<Document>;
|
|
41
43
|
findOneAndDelete(filter: Document, options?: FindOneAndDeleteOptions): Promise<Document | null>;
|
|
42
44
|
findOneAndReplace(filter: Document, replacement: Document, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Promise<Document>;
|
|
43
45
|
findOneAndUpdate(filter: Document, update: Document | Document[], options?: FindAndModifyShellOptions<FindOneAndUpdateOptions>): Promise<Document>;
|
|
44
|
-
insert(docs:
|
|
45
|
-
insertMany(docs:
|
|
46
|
-
insertOne(doc:
|
|
46
|
+
insert(docs: MQLDocument | MQLDocument[], options?: BulkWriteOptions): Promise<InsertManyResult>;
|
|
47
|
+
insertMany(docs: MQLDocument[], options?: BulkWriteOptions): Promise<InsertManyResult>;
|
|
48
|
+
insertOne(doc: MQLDocument, options?: InsertOneOptions): Promise<InsertOneResult>;
|
|
47
49
|
isCapped(): Promise<boolean>;
|
|
48
|
-
remove(query:
|
|
50
|
+
remove(query: MQLQuery, options?: boolean | RemoveShellOptions): Promise<DeleteResult | Document>;
|
|
49
51
|
replaceOne(filter: Document, replacement: Document, options?: ReplaceOptions): Promise<UpdateResult>;
|
|
50
52
|
update(filter: Document, update: Document, options?: UpdateOptions & {
|
|
51
53
|
multi?: boolean;
|
|
@@ -91,7 +93,11 @@ export declare class Collection<M extends GenericServerSideSchema = GenericServe
|
|
|
91
93
|
getShardVersion(): Promise<Document>;
|
|
92
94
|
_getShardedCollectionInfo(config: DatabaseWithSchema<M, D>, collStats: Document[]): Promise<Document>;
|
|
93
95
|
getShardDistribution(): Promise<CommandResult<GetShardDistributionResult>>;
|
|
94
|
-
|
|
96
|
+
getShardLocation(): Promise<{
|
|
97
|
+
shards: string[];
|
|
98
|
+
sharded: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): Promise<ChangeStreamCursor>;
|
|
95
101
|
hideIndex(index: string | Document): Promise<Document>;
|
|
96
102
|
unhideIndex(index: string | Document): Promise<Document>;
|
|
97
103
|
analyzeShardKey(key: Document, options?: Document): Promise<Document>;
|
|
@@ -105,6 +111,8 @@ export declare class Collection<M extends GenericServerSideSchema = GenericServe
|
|
|
105
111
|
createSearchIndexes(specs: SearchIndexDescription[]): Promise<string[]>;
|
|
106
112
|
dropSearchIndex(indexName: string): Promise<void>;
|
|
107
113
|
updateSearchIndex(indexName: string, definition: Document): Promise<void>;
|
|
114
|
+
_getSampleDocs(): Promise<Document[]>;
|
|
115
|
+
_getSampleDocsForCompletion(): Promise<Document[]>;
|
|
108
116
|
}
|
|
109
117
|
export type GetShardDistributionResult = {
|
|
110
118
|
Totals: {
|
package/lib/collection.js
CHANGED
|
@@ -114,6 +114,7 @@ let Collection = (() => {
|
|
|
114
114
|
let _validate_decorators;
|
|
115
115
|
let _getShardVersion_decorators;
|
|
116
116
|
let _getShardDistribution_decorators;
|
|
117
|
+
let _getShardLocation_decorators;
|
|
117
118
|
let _watch_decorators;
|
|
118
119
|
let _hideIndex_decorators;
|
|
119
120
|
let _unhideIndex_decorators;
|
|
@@ -129,6 +130,7 @@ let Collection = (() => {
|
|
|
129
130
|
constructor(mongo, database, name) {
|
|
130
131
|
super();
|
|
131
132
|
this._mongo = __runInitializers(this, _instanceExtraInitializers);
|
|
133
|
+
this._cachedSampleDocs = [];
|
|
132
134
|
this._mongo = mongo;
|
|
133
135
|
this._database = database;
|
|
134
136
|
this._name = name;
|
|
@@ -1058,6 +1060,35 @@ let Collection = (() => {
|
|
|
1058
1060
|
result.Totals = totalValue;
|
|
1059
1061
|
return new index_1.CommandResult('StatsResult', result);
|
|
1060
1062
|
}
|
|
1063
|
+
async getShardLocation() {
|
|
1064
|
+
this._emitCollectionApiCall('getShardLocation', {});
|
|
1065
|
+
const result = await (await this._database.aggregate([
|
|
1066
|
+
{
|
|
1067
|
+
$listClusterCatalog: {
|
|
1068
|
+
shards: true,
|
|
1069
|
+
},
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
$match: {
|
|
1073
|
+
ns: this.getFullName(),
|
|
1074
|
+
},
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
$project: {
|
|
1078
|
+
_id: 0,
|
|
1079
|
+
shards: 1,
|
|
1080
|
+
sharded: 1,
|
|
1081
|
+
},
|
|
1082
|
+
},
|
|
1083
|
+
])).toArray();
|
|
1084
|
+
if (result.length > 0) {
|
|
1085
|
+
return {
|
|
1086
|
+
shards: result[0].shards,
|
|
1087
|
+
sharded: result[0].sharded,
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
throw new errors_1.MongoshRuntimeError(`Error finding location information for ${this.getFullName()}`, errors_1.CommonErrors.CommandFailed);
|
|
1091
|
+
}
|
|
1061
1092
|
async watch(pipeline = [], options = {}) {
|
|
1062
1093
|
if (!Array.isArray(pipeline)) {
|
|
1063
1094
|
options = pipeline;
|
|
@@ -1102,7 +1133,7 @@ let Collection = (() => {
|
|
|
1102
1133
|
}
|
|
1103
1134
|
async checkMetadataConsistency(options = {}) {
|
|
1104
1135
|
this._emitCollectionApiCall('checkMetadataConsistency', { options });
|
|
1105
|
-
return this._database._runCursorCommand({
|
|
1136
|
+
return await this._database._runCursorCommand({
|
|
1106
1137
|
checkMetadataConsistency: this._name,
|
|
1107
1138
|
});
|
|
1108
1139
|
}
|
|
@@ -1164,6 +1195,25 @@ let Collection = (() => {
|
|
|
1164
1195
|
this._emitCollectionApiCall('updateSearchIndex', { indexName, definition });
|
|
1165
1196
|
return await this._mongo._serviceProvider.updateSearchIndex(this._database._name, this._name, indexName, definition);
|
|
1166
1197
|
}
|
|
1198
|
+
async _getSampleDocs() {
|
|
1199
|
+
this._cachedSampleDocs = await (await this.aggregate([{ $sample: { size: 10 } }], {
|
|
1200
|
+
allowDiskUse: true,
|
|
1201
|
+
maxTimeMS: 1000,
|
|
1202
|
+
readPreference: 'secondaryPreferred',
|
|
1203
|
+
})).toArray();
|
|
1204
|
+
return this._cachedSampleDocs;
|
|
1205
|
+
}
|
|
1206
|
+
async _getSampleDocsForCompletion() {
|
|
1207
|
+
return await Promise.race([
|
|
1208
|
+
(async () => {
|
|
1209
|
+
return await this._getSampleDocs();
|
|
1210
|
+
})(),
|
|
1211
|
+
(async () => {
|
|
1212
|
+
await new Promise((resolve) => { var _a, _b; return (_b = (_a = setTimeout(resolve, 200)) === null || _a === void 0 ? void 0 : _a.unref) === null || _b === void 0 ? void 0 : _b.call(_a); });
|
|
1213
|
+
return this._cachedSampleDocs;
|
|
1214
|
+
})(),
|
|
1215
|
+
]);
|
|
1216
|
+
}
|
|
1167
1217
|
};
|
|
1168
1218
|
__setFunctionName(_classThis, "Collection");
|
|
1169
1219
|
(() => {
|
|
@@ -1224,6 +1274,7 @@ let Collection = (() => {
|
|
|
1224
1274
|
_validate_decorators = [decorators_1.returnsPromise, (0, decorators_1.apiVersions)([])];
|
|
1225
1275
|
_getShardVersion_decorators = [decorators_1.returnsPromise, (0, decorators_1.topologies)([enums_1.Topologies.Sharded]), (0, decorators_1.apiVersions)([])];
|
|
1226
1276
|
_getShardDistribution_decorators = [decorators_1.returnsPromise, (0, decorators_1.topologies)([enums_1.Topologies.Sharded]), (0, decorators_1.apiVersions)([])];
|
|
1277
|
+
_getShardLocation_decorators = [decorators_1.returnsPromise, (0, decorators_1.topologies)([enums_1.Topologies.Sharded]), (0, decorators_1.apiVersions)([]), (0, decorators_1.serverVersions)(['8.0.10', enums_1.ServerVersions.latest])];
|
|
1227
1278
|
_watch_decorators = [(0, decorators_1.serverVersions)(['3.1.0', enums_1.ServerVersions.latest]), (0, decorators_1.topologies)([enums_1.Topologies.ReplSet, enums_1.Topologies.Sharded]), (0, decorators_1.apiVersions)([1]), decorators_1.returnsPromise];
|
|
1228
1279
|
_hideIndex_decorators = [(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]), decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
1229
1280
|
_unhideIndex_decorators = [(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]), decorators_1.returnsPromise, (0, decorators_1.apiVersions)([1])];
|
|
@@ -1290,6 +1341,7 @@ let Collection = (() => {
|
|
|
1290
1341
|
__esDecorate(_classThis, null, _validate_decorators, { kind: "method", name: "validate", static: false, private: false, access: { has: obj => "validate" in obj, get: obj => obj.validate }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1291
1342
|
__esDecorate(_classThis, null, _getShardVersion_decorators, { kind: "method", name: "getShardVersion", static: false, private: false, access: { has: obj => "getShardVersion" in obj, get: obj => obj.getShardVersion }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1292
1343
|
__esDecorate(_classThis, null, _getShardDistribution_decorators, { kind: "method", name: "getShardDistribution", static: false, private: false, access: { has: obj => "getShardDistribution" in obj, get: obj => obj.getShardDistribution }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1344
|
+
__esDecorate(_classThis, null, _getShardLocation_decorators, { kind: "method", name: "getShardLocation", static: false, private: false, access: { has: obj => "getShardLocation" in obj, get: obj => obj.getShardLocation }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1293
1345
|
__esDecorate(_classThis, null, _watch_decorators, { kind: "method", name: "watch", static: false, private: false, access: { has: obj => "watch" in obj, get: obj => obj.watch }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1294
1346
|
__esDecorate(_classThis, null, _hideIndex_decorators, { kind: "method", name: "hideIndex", static: false, private: false, access: { has: obj => "hideIndex" in obj, get: obj => obj.hideIndex }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1295
1347
|
__esDecorate(_classThis, null, _unhideIndex_decorators, { kind: "method", name: "unhideIndex", static: false, private: false, access: { has: obj => "unhideIndex" in obj, get: obj => obj.unhideIndex }, metadata: _metadata }, null, _instanceExtraInitializers);
|