mongodb 4.1.1 → 4.2.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/README.md +24 -17
- package/lib/admin.js +5 -5
- package/lib/admin.js.map +1 -1
- package/lib/bulk/common.js +60 -56
- package/lib/bulk/common.js.map +1 -1
- package/lib/change_stream.js +15 -13
- package/lib/change_stream.js.map +1 -1
- package/lib/cmap/auth/gssapi.js +1 -1
- package/lib/cmap/auth/gssapi.js.map +1 -1
- package/lib/cmap/auth/mongo_credentials.js +2 -1
- package/lib/cmap/auth/mongo_credentials.js.map +1 -1
- package/lib/cmap/auth/mongocr.js +2 -2
- package/lib/cmap/auth/mongocr.js.map +1 -1
- package/lib/cmap/auth/mongodb_aws.js +23 -28
- package/lib/cmap/auth/mongodb_aws.js.map +1 -1
- package/lib/cmap/auth/plain.js +1 -1
- package/lib/cmap/auth/plain.js.map +1 -1
- package/lib/cmap/auth/scram.js +5 -5
- package/lib/cmap/auth/scram.js.map +1 -1
- package/lib/cmap/auth/x509.js +1 -1
- package/lib/cmap/auth/x509.js.map +1 -1
- package/lib/cmap/command_monitoring_events.js +15 -15
- package/lib/cmap/command_monitoring_events.js.map +1 -1
- package/lib/cmap/commands.js +1 -1
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connect.js +2 -2
- package/lib/cmap/connect.js.map +1 -1
- package/lib/cmap/connection.js +15 -15
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/connection_pool.js +3 -3
- package/lib/cmap/connection_pool.js.map +1 -1
- package/lib/cmap/message_stream.js +2 -2
- package/lib/cmap/message_stream.js.map +1 -1
- package/lib/cmap/stream_description.js +1 -1
- package/lib/cmap/stream_description.js.map +1 -1
- package/lib/cmap/wire_protocol/constants.js +4 -4
- package/lib/collection.js +42 -41
- package/lib/collection.js.map +1 -1
- package/lib/connection_string.js +94 -58
- package/lib/connection_string.js.map +1 -1
- package/lib/cursor/abstract_cursor.js +11 -11
- package/lib/cursor/abstract_cursor.js.map +1 -1
- package/lib/cursor/aggregation_cursor.js +15 -15
- package/lib/cursor/aggregation_cursor.js.map +1 -1
- package/lib/cursor/find_cursor.js +23 -23
- package/lib/cursor/find_cursor.js.map +1 -1
- package/lib/db.js +20 -20
- package/lib/db.js.map +1 -1
- package/lib/deps.js +1 -1
- package/lib/deps.js.map +1 -1
- package/lib/gridfs/index.js +3 -3
- package/lib/gridfs/index.js.map +1 -1
- package/lib/gridfs/upload.js +1 -1
- package/lib/gridfs/upload.js.map +1 -1
- package/lib/index.js +8 -2
- package/lib/index.js.map +1 -1
- package/lib/logger.js +5 -5
- package/lib/logger.js.map +1 -1
- package/lib/mongo_client.js +7 -7
- package/lib/mongo_client.js.map +1 -1
- package/lib/mongo_types.js.map +1 -1
- package/lib/operations/add_user.js +3 -3
- package/lib/operations/add_user.js.map +1 -1
- package/lib/operations/aggregate.js +3 -4
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/bulk_write.js +1 -1
- package/lib/operations/bulk_write.js.map +1 -1
- package/lib/operations/command.js +7 -3
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/common_functions.js +1 -1
- package/lib/operations/common_functions.js.map +1 -1
- package/lib/operations/connect.js +1 -1
- package/lib/operations/connect.js.map +1 -1
- package/lib/operations/count.js +1 -1
- package/lib/operations/count.js.map +1 -1
- package/lib/operations/count_documents.js.map +1 -1
- package/lib/operations/create_collection.js +1 -1
- package/lib/operations/create_collection.js.map +1 -1
- package/lib/operations/delete.js +6 -6
- package/lib/operations/delete.js.map +1 -1
- package/lib/operations/distinct.js +4 -4
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/drop.js +2 -2
- package/lib/operations/drop.js.map +1 -1
- package/lib/operations/estimated_document_count.js +2 -2
- package/lib/operations/estimated_document_count.js.map +1 -1
- package/lib/operations/eval.js.map +1 -1
- package/lib/operations/execute_operation.js +17 -7
- package/lib/operations/execute_operation.js.map +1 -1
- package/lib/operations/find.js +8 -8
- package/lib/operations/find.js.map +1 -1
- package/lib/operations/find_and_modify.js +7 -7
- package/lib/operations/find_and_modify.js.map +1 -1
- package/lib/operations/indexes.js +14 -14
- package/lib/operations/indexes.js.map +1 -1
- package/lib/operations/insert.js +5 -5
- package/lib/operations/insert.js.map +1 -1
- package/lib/operations/list_collections.js +12 -7
- package/lib/operations/list_collections.js.map +1 -1
- package/lib/operations/list_databases.js +1 -1
- package/lib/operations/list_databases.js.map +1 -1
- package/lib/operations/map_reduce.js +6 -6
- package/lib/operations/map_reduce.js.map +1 -1
- package/lib/operations/operation.js +2 -1
- package/lib/operations/operation.js.map +1 -1
- package/lib/operations/remove_user.js +1 -1
- package/lib/operations/remove_user.js.map +1 -1
- package/lib/operations/rename.js +2 -2
- package/lib/operations/rename.js.map +1 -1
- package/lib/operations/set_profiling_level.js +1 -1
- package/lib/operations/set_profiling_level.js.map +1 -1
- package/lib/operations/stats.js +2 -2
- package/lib/operations/stats.js.map +1 -1
- package/lib/operations/update.js +12 -12
- package/lib/operations/update.js.map +1 -1
- package/lib/sdam/monitor.js +14 -14
- package/lib/sdam/monitor.js.map +1 -1
- package/lib/sdam/server.js +19 -12
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/server_description.js +3 -3
- package/lib/sdam/server_description.js.map +1 -1
- package/lib/sdam/server_selection.js +20 -1
- package/lib/sdam/server_selection.js.map +1 -1
- package/lib/sdam/srv_polling.js +9 -9
- package/lib/sdam/srv_polling.js.map +1 -1
- package/lib/sdam/topology.js +29 -21
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +34 -12
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +19 -19
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +53 -46
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +97 -50
- package/mongodb.ts34.d.ts +96 -50
- package/package.json +44 -47
- package/src/bulk/common.ts +56 -35
- package/src/change_stream.ts +8 -6
- package/src/cmap/auth/mongo_credentials.ts +14 -3
- package/src/cmap/auth/mongodb_aws.ts +32 -31
- package/src/cmap/command_monitoring_events.ts +1 -1
- package/src/cmap/connection.ts +1 -0
- package/src/cmap/wire_protocol/constants.ts +4 -4
- package/src/collection.ts +32 -24
- package/src/connection_string.ts +103 -52
- package/src/cursor/abstract_cursor.ts +6 -4
- package/src/cursor/aggregation_cursor.ts +3 -3
- package/src/cursor/find_cursor.ts +1 -1
- package/src/db.ts +5 -6
- package/src/deps.ts +56 -19
- package/src/gridfs/download.ts +1 -1
- package/src/gridfs/upload.ts +11 -7
- package/src/index.ts +12 -1
- package/src/mongo_client.ts +18 -11
- package/src/mongo_types.ts +10 -13
- package/src/operations/aggregate.ts +1 -2
- package/src/operations/command.ts +5 -0
- package/src/operations/count.ts +1 -1
- package/src/operations/count_documents.ts +1 -1
- package/src/operations/create_collection.ts +1 -1
- package/src/operations/eval.ts +1 -1
- package/src/operations/execute_operation.ts +13 -2
- package/src/operations/indexes.ts +2 -2
- package/src/operations/list_collections.ts +12 -4
- package/src/operations/list_databases.ts +6 -1
- package/src/operations/operation.ts +3 -0
- package/src/sdam/server.ts +8 -0
- package/src/sdam/server_selection.ts +25 -0
- package/src/sdam/srv_polling.ts +12 -11
- package/src/sdam/topology.ts +27 -10
- package/src/sdam/topology_description.ts +35 -11
- package/src/transactions.ts +2 -2
- package/src/utils.ts +67 -56
package/mongodb.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { Readable } from 'stream';
|
|
|
26
26
|
import type { serialize as serialize_2 } from 'bson';
|
|
27
27
|
import type { SerializeOptions } from 'bson';
|
|
28
28
|
import type { Socket } from 'net';
|
|
29
|
+
import type { SrvRecord } from 'dns';
|
|
29
30
|
import type { TcpNetConnectOpts } from 'net';
|
|
30
31
|
import { Timestamp } from 'bson';
|
|
31
32
|
import type { TLSSocket } from 'tls';
|
|
@@ -406,8 +407,11 @@ export declare class AggregationCursor<TSchema = Document> extends AbstractCurso
|
|
|
406
407
|
limit($limit: number): this;
|
|
407
408
|
/** Add a match stage to the aggregation pipeline */
|
|
408
409
|
match($match: Document): this;
|
|
409
|
-
/** Add
|
|
410
|
-
out($out:
|
|
410
|
+
/** Add an out stage to the aggregation pipeline */
|
|
411
|
+
out($out: {
|
|
412
|
+
db: string;
|
|
413
|
+
coll: string;
|
|
414
|
+
} | string): this;
|
|
411
415
|
/**
|
|
412
416
|
* Add a project stage to the aggregation pipeline
|
|
413
417
|
*
|
|
@@ -525,6 +529,14 @@ export declare const AuthMechanism: Readonly<{
|
|
|
525
529
|
/** @public */
|
|
526
530
|
export declare type AuthMechanism = typeof AuthMechanism[keyof typeof AuthMechanism];
|
|
527
531
|
|
|
532
|
+
/** @public */
|
|
533
|
+
export declare interface AuthMechanismProperties extends Document {
|
|
534
|
+
SERVICE_NAME?: string;
|
|
535
|
+
SERVICE_REALM?: string;
|
|
536
|
+
CANONICALIZE_HOST_NAME?: boolean;
|
|
537
|
+
AWS_SESSION_TOKEN?: string;
|
|
538
|
+
}
|
|
539
|
+
|
|
528
540
|
/** @public */
|
|
529
541
|
export declare interface AutoEncrypter {
|
|
530
542
|
new (client: MongoClient, options: AutoEncryptionOptions): AutoEncrypter;
|
|
@@ -776,8 +788,10 @@ export declare abstract class BulkOperationBase {
|
|
|
776
788
|
get bsonOptions(): BSONSerializeOptions;
|
|
777
789
|
get writeConcern(): WriteConcern | undefined;
|
|
778
790
|
get batches(): Batch[];
|
|
779
|
-
|
|
780
|
-
execute(
|
|
791
|
+
execute(options?: BulkWriteOptions): Promise<BulkWriteResult>;
|
|
792
|
+
execute(callback: Callback<BulkWriteResult>): void;
|
|
793
|
+
execute(options: BulkWriteOptions | undefined, callback: Callback<BulkWriteResult>): void;
|
|
794
|
+
execute(options?: BulkWriteOptions | Callback<BulkWriteResult>, callback?: Callback<BulkWriteResult>): Promise<BulkWriteResult> | void;
|
|
781
795
|
/* Excluded from this release type: handleWriteError */
|
|
782
796
|
abstract addToOperationsList(batchType: BatchType, document: Document | UpdateStatement | DeleteStatement): this;
|
|
783
797
|
}
|
|
@@ -804,6 +818,7 @@ export declare interface BulkWriteOperationError {
|
|
|
804
818
|
index: number;
|
|
805
819
|
code: number;
|
|
806
820
|
errmsg: string;
|
|
821
|
+
errInfo: Document;
|
|
807
822
|
op: Document | UpdateStatement | DeleteStatement;
|
|
808
823
|
}
|
|
809
824
|
|
|
@@ -897,7 +912,7 @@ export declare class CancellationToken extends TypedEventEmitter<{
|
|
|
897
912
|
* Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
|
|
898
913
|
* @public
|
|
899
914
|
*/
|
|
900
|
-
export declare class ChangeStream<TSchema extends Document = Document> extends TypedEventEmitter<ChangeStreamEvents
|
|
915
|
+
export declare class ChangeStream<TSchema extends Document = Document> extends TypedEventEmitter<ChangeStreamEvents<TSchema>> {
|
|
901
916
|
pipeline: Document[];
|
|
902
917
|
options: ChangeStreamOptions;
|
|
903
918
|
parent: MongoClient | Db | Collection;
|
|
@@ -1015,14 +1030,14 @@ export declare interface ChangeStreamDocument<TSchema extends Document = Documen
|
|
|
1015
1030
|
}
|
|
1016
1031
|
|
|
1017
1032
|
/** @public */
|
|
1018
|
-
export declare type ChangeStreamEvents = {
|
|
1033
|
+
export declare type ChangeStreamEvents<TSchema extends Document = Document> = {
|
|
1019
1034
|
resumeTokenChanged(token: ResumeToken): void;
|
|
1020
|
-
init(response:
|
|
1021
|
-
more(response?:
|
|
1035
|
+
init(response: TSchema): void;
|
|
1036
|
+
more(response?: TSchema | undefined): void;
|
|
1022
1037
|
response(): void;
|
|
1023
1038
|
end(): void;
|
|
1024
1039
|
error(error: Error): void;
|
|
1025
|
-
change(change: ChangeStreamDocument): void;
|
|
1040
|
+
change(change: ChangeStreamDocument<TSchema>): void;
|
|
1026
1041
|
} & AbstractCursorEvents;
|
|
1027
1042
|
|
|
1028
1043
|
/**
|
|
@@ -1437,12 +1452,12 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1437
1452
|
* @param options - Optional settings for the command
|
|
1438
1453
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1439
1454
|
*/
|
|
1440
|
-
findOne(): Promise<TSchema | null>;
|
|
1441
|
-
findOne(callback: Callback<TSchema | null>): void;
|
|
1442
|
-
findOne(filter: Filter<TSchema>): Promise<TSchema | null>;
|
|
1443
|
-
findOne(filter: Filter<TSchema>, callback: Callback<TSchema | null>): void;
|
|
1444
|
-
findOne(filter: Filter<TSchema>, options: FindOptions): Promise<TSchema | null>;
|
|
1445
|
-
findOne(filter: Filter<TSchema>, options: FindOptions, callback: Callback<TSchema | null>): void;
|
|
1455
|
+
findOne(): Promise<WithId<TSchema> | null>;
|
|
1456
|
+
findOne(callback: Callback<WithId<TSchema> | null>): void;
|
|
1457
|
+
findOne(filter: Filter<TSchema>): Promise<WithId<TSchema> | null>;
|
|
1458
|
+
findOne(filter: Filter<TSchema>, callback: Callback<WithId<TSchema> | null>): void;
|
|
1459
|
+
findOne(filter: Filter<TSchema>, options: FindOptions): Promise<WithId<TSchema> | null>;
|
|
1460
|
+
findOne(filter: Filter<TSchema>, options: FindOptions, callback: Callback<WithId<TSchema> | null>): void;
|
|
1446
1461
|
findOne<T = TSchema>(): Promise<T | null>;
|
|
1447
1462
|
findOne<T = TSchema>(callback: Callback<T | null>): void;
|
|
1448
1463
|
findOne<T = TSchema>(filter: Filter<TSchema>): Promise<T | null>;
|
|
@@ -1453,9 +1468,9 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1453
1468
|
*
|
|
1454
1469
|
* @param filter - The filter predicate. If unspecified, then all documents in the collection will match the predicate
|
|
1455
1470
|
*/
|
|
1456
|
-
find(): FindCursor<TSchema
|
|
1457
|
-
find(filter: Filter<TSchema
|
|
1458
|
-
find<T>(filter: Filter<TSchema
|
|
1471
|
+
find(): FindCursor<WithId<TSchema>>;
|
|
1472
|
+
find(filter: Filter<WithId<TSchema>>, options?: FindOptions): FindCursor<WithId<TSchema>>;
|
|
1473
|
+
find<T>(filter: Filter<WithId<TSchema>>, options?: FindOptions): FindCursor<T>;
|
|
1459
1474
|
/**
|
|
1460
1475
|
* Returns the options of the collection.
|
|
1461
1476
|
*
|
|
@@ -1662,10 +1677,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1662
1677
|
* @param options - Optional settings for the command
|
|
1663
1678
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1664
1679
|
*/
|
|
1665
|
-
indexes(): Promise<Document>;
|
|
1666
|
-
indexes(callback: Callback<Document>): void;
|
|
1667
|
-
indexes(options: IndexInformationOptions): Promise<Document>;
|
|
1668
|
-
indexes(options: IndexInformationOptions, callback: Callback<Document>): void;
|
|
1680
|
+
indexes(): Promise<Document[]>;
|
|
1681
|
+
indexes(callback: Callback<Document[]>): void;
|
|
1682
|
+
indexes(options: IndexInformationOptions): Promise<Document[]>;
|
|
1683
|
+
indexes(options: IndexInformationOptions, callback: Callback<Document[]>): void;
|
|
1669
1684
|
/**
|
|
1670
1685
|
* Get all the collection statistics.
|
|
1671
1686
|
*
|
|
@@ -1717,7 +1732,7 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1717
1732
|
* @param pipeline - An array of aggregation pipelines to execute
|
|
1718
1733
|
* @param options - Optional settings for the command
|
|
1719
1734
|
*/
|
|
1720
|
-
aggregate<T =
|
|
1735
|
+
aggregate<T = Document>(pipeline?: Document[], options?: AggregateOptions): AggregationCursor<T>;
|
|
1721
1736
|
/**
|
|
1722
1737
|
* Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection.
|
|
1723
1738
|
*
|
|
@@ -1729,6 +1744,7 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1729
1744
|
/**
|
|
1730
1745
|
* Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
|
|
1731
1746
|
*
|
|
1747
|
+
* @deprecated collection.mapReduce is deprecated. Use the aggregation pipeline instead. Visit https://docs.mongodb.com/manual/reference/map-reduce-to-aggregation-pipeline for more information on how to translate map-reduce operations to the aggregation pipeline.
|
|
1732
1748
|
* @param map - The mapping function.
|
|
1733
1749
|
* @param reduce - The reduce function.
|
|
1734
1750
|
* @param options - Optional settings for the command
|
|
@@ -2330,10 +2346,9 @@ export declare class Db {
|
|
|
2330
2346
|
* @param options - Optional settings for the command
|
|
2331
2347
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
2332
2348
|
*/
|
|
2333
|
-
createCollection<TSchema extends Document = Document>(name: string): Promise<Collection<TSchema>>;
|
|
2349
|
+
createCollection<TSchema extends Document = Document>(name: string, options?: CreateCollectionOptions): Promise<Collection<TSchema>>;
|
|
2334
2350
|
createCollection<TSchema extends Document = Document>(name: string, callback: Callback<Collection<TSchema>>): void;
|
|
2335
|
-
createCollection<TSchema extends Document = Document>(name: string, options: CreateCollectionOptions
|
|
2336
|
-
createCollection<TSchema extends Document = Document>(name: string, options: CreateCollectionOptions, callback: Callback<Collection<TSchema>>): void;
|
|
2351
|
+
createCollection<TSchema extends Document = Document>(name: string, options: CreateCollectionOptions | undefined, callback: Callback<Collection<TSchema>>): void;
|
|
2337
2352
|
/**
|
|
2338
2353
|
* Execute a command
|
|
2339
2354
|
*
|
|
@@ -3150,7 +3165,7 @@ export declare interface GridFSBucketOptions extends WriteConcernOptions {
|
|
|
3150
3165
|
* Do not instantiate this class directly. Use `openDownloadStream()` instead.
|
|
3151
3166
|
* @public
|
|
3152
3167
|
*/
|
|
3153
|
-
export declare class GridFSBucketReadStream extends Readable {
|
|
3168
|
+
export declare class GridFSBucketReadStream extends Readable implements NodeJS.ReadableStream {
|
|
3154
3169
|
/* Excluded from this release type: s */
|
|
3155
3170
|
/**
|
|
3156
3171
|
* An error occurred
|
|
@@ -3231,7 +3246,7 @@ export declare interface GridFSBucketReadStreamOptionsWithRevision extends GridF
|
|
|
3231
3246
|
* Do not instantiate this class directly. Use `openUploadStream()` instead.
|
|
3232
3247
|
* @public
|
|
3233
3248
|
*/
|
|
3234
|
-
export declare class GridFSBucketWriteStream extends Writable {
|
|
3249
|
+
export declare class GridFSBucketWriteStream extends Writable implements NodeJS.WritableStream {
|
|
3235
3250
|
bucket: GridFSBucket;
|
|
3236
3251
|
chunks: Collection<GridFSChunk>;
|
|
3237
3252
|
filename: string;
|
|
@@ -3269,10 +3284,10 @@ export declare class GridFSBucketWriteStream extends Writable {
|
|
|
3269
3284
|
* @param callback - Function to call when the chunk was added to the buffer, or if the entire chunk was persisted to MongoDB if this chunk caused a flush.
|
|
3270
3285
|
* @returns False if this write required flushing a chunk to MongoDB. True otherwise.
|
|
3271
3286
|
*/
|
|
3272
|
-
write(chunk: Buffer): boolean;
|
|
3273
|
-
write(chunk: Buffer, callback: Callback<void>): boolean;
|
|
3274
|
-
write(chunk: Buffer, encoding: BufferEncoding | undefined): boolean;
|
|
3275
|
-
write(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<void>): boolean;
|
|
3287
|
+
write(chunk: Buffer | string): boolean;
|
|
3288
|
+
write(chunk: Buffer | string, callback: Callback<void>): boolean;
|
|
3289
|
+
write(chunk: Buffer | string, encoding: BufferEncoding | undefined): boolean;
|
|
3290
|
+
write(chunk: Buffer | string, encoding: BufferEncoding | undefined, callback: Callback<void>): boolean;
|
|
3276
3291
|
/**
|
|
3277
3292
|
* Places this write stream into an aborted state (all future writes fail)
|
|
3278
3293
|
* and deletes all chunks that have already been written.
|
|
@@ -3348,11 +3363,13 @@ export declare class HostAddress {
|
|
|
3348
3363
|
socketPath: string | undefined;
|
|
3349
3364
|
isIPv6: boolean | undefined;
|
|
3350
3365
|
constructor(hostString: string);
|
|
3366
|
+
inspect(): string;
|
|
3351
3367
|
/**
|
|
3352
3368
|
* @param ipv6Brackets - optionally request ipv6 bracket notation required for connection strings
|
|
3353
3369
|
*/
|
|
3354
3370
|
toString(ipv6Brackets?: boolean): string;
|
|
3355
3371
|
static fromString(s: string): HostAddress;
|
|
3372
|
+
static fromSrvRecord({ name, port }: SrvRecord): HostAddress;
|
|
3356
3373
|
}
|
|
3357
3374
|
|
|
3358
3375
|
/** @public */
|
|
@@ -3590,6 +3607,8 @@ export declare class ListCollectionsCursor<T extends Pick<CollectionInfo, 'name'
|
|
|
3590
3607
|
export declare interface ListCollectionsOptions extends CommandOperationOptions {
|
|
3591
3608
|
/** Since 4.0: If true, will only return the collection name in the response, and will omit additional info */
|
|
3592
3609
|
nameOnly?: boolean;
|
|
3610
|
+
/** Since 4.0: If true and nameOnly is true, allows a user without the required privilege (i.e. listCollections action on the database) to run the command when access control is enforced. */
|
|
3611
|
+
authorizedCollections?: boolean;
|
|
3593
3612
|
/** The batchSize for the returned command cursor or if pre 2.8 the systems batch collection */
|
|
3594
3613
|
batchSize?: number;
|
|
3595
3614
|
}
|
|
@@ -3605,7 +3624,16 @@ export declare interface ListDatabasesOptions extends CommandOperationOptions {
|
|
|
3605
3624
|
}
|
|
3606
3625
|
|
|
3607
3626
|
/** @public */
|
|
3608
|
-
export declare
|
|
3627
|
+
export declare interface ListDatabasesResult {
|
|
3628
|
+
databases: ({
|
|
3629
|
+
name: string;
|
|
3630
|
+
sizeOnDisk?: number;
|
|
3631
|
+
empty?: boolean;
|
|
3632
|
+
} & Document)[];
|
|
3633
|
+
totalSize?: number;
|
|
3634
|
+
totalSizeMb?: number;
|
|
3635
|
+
ok: 1 | 0;
|
|
3636
|
+
}
|
|
3609
3637
|
|
|
3610
3638
|
/** @public */
|
|
3611
3639
|
export declare class ListIndexesCursor extends AbstractCursor {
|
|
@@ -3988,7 +4016,7 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
3988
4016
|
ssl?: boolean;
|
|
3989
4017
|
/** Specifies the location of a local TLS Certificate */
|
|
3990
4018
|
tlsCertificateFile?: string;
|
|
3991
|
-
/** Specifies the location of a local .pem file that contains either the client
|
|
4019
|
+
/** Specifies the location of a local .pem file that contains either the client's TLS/SSL certificate and key or only the client's TLS/SSL key when tlsCertificateFile is used to provide the certificate. */
|
|
3992
4020
|
tlsCertificateKeyFile?: string;
|
|
3993
4021
|
/** Specifies the password to de-crypt the tlsCertificateKeyFile. */
|
|
3994
4022
|
tlsCertificateKeyFilePassword?: string;
|
|
@@ -4004,10 +4032,20 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
4004
4032
|
connectTimeoutMS?: number;
|
|
4005
4033
|
/** The time in milliseconds to attempt a send or receive on a socket before the attempt times out. */
|
|
4006
4034
|
socketTimeoutMS?: number;
|
|
4007
|
-
/**
|
|
4008
|
-
compressors?: CompressorName[];
|
|
4035
|
+
/** An array or comma-delimited string of compressors to enable network compression for communication between this client and a mongod/mongos instance. */
|
|
4036
|
+
compressors?: CompressorName[] | string;
|
|
4009
4037
|
/** An integer that specifies the compression level if using zlib for network compression. */
|
|
4010
4038
|
zlibCompressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
|
|
4039
|
+
/** The maximum number of hosts to connect to when using an srv connection string, a setting of `0` means unlimited hosts */
|
|
4040
|
+
srvMaxHosts?: number;
|
|
4041
|
+
/**
|
|
4042
|
+
* Modifies the srv URI to look like:
|
|
4043
|
+
*
|
|
4044
|
+
* `_{srvServiceName}._tcp.{hostname}.{domainname}`
|
|
4045
|
+
*
|
|
4046
|
+
* Querying this DNS URI is expected to respond with SRV records
|
|
4047
|
+
*/
|
|
4048
|
+
srvServiceName?: string;
|
|
4011
4049
|
/** The maximum number of connections in the connection pool. */
|
|
4012
4050
|
maxPoolSize?: number;
|
|
4013
4051
|
/** The minimum number of connections in the connection pool. */
|
|
@@ -4033,12 +4071,7 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
4033
4071
|
/** Specify the authentication mechanism that MongoDB will use to authenticate the connection. */
|
|
4034
4072
|
authMechanism?: AuthMechanism;
|
|
4035
4073
|
/** Specify properties for the specified authMechanism as a comma-separated list of colon-separated key-value pairs. */
|
|
4036
|
-
authMechanismProperties?:
|
|
4037
|
-
SERVICE_NAME?: string;
|
|
4038
|
-
CANONICALIZE_HOST_NAME?: boolean;
|
|
4039
|
-
SERVICE_REALM?: string;
|
|
4040
|
-
[key: string]: any;
|
|
4041
|
-
};
|
|
4074
|
+
authMechanismProperties?: AuthMechanismProperties;
|
|
4042
4075
|
/** The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances. */
|
|
4043
4076
|
localThresholdMS?: number;
|
|
4044
4077
|
/** Specifies how long (in milliseconds) to block for server selection before throwing an exception. */
|
|
@@ -4148,7 +4181,7 @@ export declare class MongoCredentials {
|
|
|
4148
4181
|
/** The method used to authenticate */
|
|
4149
4182
|
readonly mechanism: AuthMechanism;
|
|
4150
4183
|
/** Special properties used by some types of auth mechanisms */
|
|
4151
|
-
readonly mechanismProperties:
|
|
4184
|
+
readonly mechanismProperties: AuthMechanismProperties;
|
|
4152
4185
|
constructor(options: MongoCredentialsOptions);
|
|
4153
4186
|
/** Determines if two MongoCredentials objects are equivalent */
|
|
4154
4187
|
equals(other: MongoCredentials): boolean;
|
|
@@ -4170,7 +4203,7 @@ export declare interface MongoCredentialsOptions {
|
|
|
4170
4203
|
source: string;
|
|
4171
4204
|
db?: string;
|
|
4172
4205
|
mechanism?: AuthMechanism;
|
|
4173
|
-
mechanismProperties:
|
|
4206
|
+
mechanismProperties: AuthMechanismProperties;
|
|
4174
4207
|
}
|
|
4175
4208
|
|
|
4176
4209
|
/**
|
|
@@ -4395,7 +4428,7 @@ export declare class MongoNotConnectedError extends MongoAPIError {
|
|
|
4395
4428
|
* Mongo Client Options
|
|
4396
4429
|
* @public
|
|
4397
4430
|
*/
|
|
4398
|
-
export declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEncryption' | '
|
|
4431
|
+
export declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEncryption' | 'connectTimeoutMS' | 'directConnection' | 'driverInfo' | 'forceServerObjectId' | 'minHeartbeatFrequencyMS' | 'heartbeatFrequencyMS' | 'keepAlive' | 'keepAliveInitialDelay' | 'localThresholdMS' | 'logger' | 'maxIdleTimeMS' | 'maxPoolSize' | 'minPoolSize' | 'monitorCommands' | 'noDelay' | 'pkFactory' | 'promiseLibrary' | 'raw' | 'replicaSet' | 'retryReads' | 'retryWrites' | 'serverSelectionTimeoutMS' | 'socketTimeoutMS' | 'srvMaxHosts' | 'srvServiceName' | 'tlsAllowInvalidCertificates' | 'tlsAllowInvalidHostnames' | 'tlsInsecure' | 'waitQueueTimeoutMS' | 'zlibCompressionLevel'>>, SupportedNodeConnectionOptions {
|
|
4399
4432
|
hosts: HostAddress[];
|
|
4400
4433
|
srvHost?: string;
|
|
4401
4434
|
credentials?: MongoCredentials;
|
|
@@ -4403,6 +4436,7 @@ export declare interface MongoOptions extends Required<Pick<MongoClientOptions,
|
|
|
4403
4436
|
readConcern: ReadConcern;
|
|
4404
4437
|
loadBalanced: boolean;
|
|
4405
4438
|
serverApi: ServerApi;
|
|
4439
|
+
compressors: CompressorName[];
|
|
4406
4440
|
writeConcern: WriteConcern;
|
|
4407
4441
|
dbName: string;
|
|
4408
4442
|
metadata: ClientMetadata;
|
|
@@ -4578,6 +4612,12 @@ export declare type NotAcceptedFields<TSchema, FieldType> = {
|
|
|
4578
4612
|
/** @public */
|
|
4579
4613
|
export declare type NumericType = IntegerType | Decimal128 | Double;
|
|
4580
4614
|
|
|
4615
|
+
/**
|
|
4616
|
+
* @public
|
|
4617
|
+
* @deprecated Please use `ObjectId`
|
|
4618
|
+
*/
|
|
4619
|
+
export declare const ObjectID: typeof ObjectId;
|
|
4620
|
+
|
|
4581
4621
|
export { ObjectId }
|
|
4582
4622
|
|
|
4583
4623
|
/** @public */
|
|
@@ -4596,6 +4636,7 @@ export declare interface OperationOptions extends BSONSerializeOptions {
|
|
|
4596
4636
|
/** The preferred read preference (ReadPreference.primary, ReadPreference.primary_preferred, ReadPreference.secondary, ReadPreference.secondary_preferred, ReadPreference.nearest). */
|
|
4597
4637
|
readPreference?: ReadPreferenceLike;
|
|
4598
4638
|
/* Excluded from this release type: bypassPinningCheck */
|
|
4639
|
+
omitReadPreference?: boolean;
|
|
4599
4640
|
}
|
|
4600
4641
|
|
|
4601
4642
|
/* Excluded from this release type: OperationParent */
|
|
@@ -4621,11 +4662,13 @@ export declare type OperationTime = Timestamp;
|
|
|
4621
4662
|
* `TSchema['_id'] extends ObjectId` which translated to "Is the _id property ObjectId?"
|
|
4622
4663
|
* we instead ask "Does ObjectId look like (have the same shape) as the _id?"
|
|
4623
4664
|
*/
|
|
4624
|
-
export declare type OptionalId<TSchema extends {
|
|
4665
|
+
export declare type OptionalId<TSchema> = TSchema extends {
|
|
4625
4666
|
_id?: any;
|
|
4626
|
-
}
|
|
4667
|
+
} ? ObjectId extends TSchema['_id'] ? EnhancedOmit<TSchema, '_id'> & {
|
|
4668
|
+
_id?: InferIdType<TSchema>;
|
|
4669
|
+
} : WithId<TSchema> : EnhancedOmit<TSchema, '_id'> & {
|
|
4627
4670
|
_id?: InferIdType<TSchema>;
|
|
4628
|
-
}
|
|
4671
|
+
};
|
|
4629
4672
|
|
|
4630
4673
|
/** @public */
|
|
4631
4674
|
export declare class OrderedBulkOperation extends BulkOperationBase {
|
|
@@ -5303,7 +5346,7 @@ export declare type TagSet = {
|
|
|
5303
5346
|
export declare interface TimeSeriesCollectionOptions extends Document {
|
|
5304
5347
|
timeField: string;
|
|
5305
5348
|
metaField?: string;
|
|
5306
|
-
granularity?: string;
|
|
5349
|
+
granularity?: 'seconds' | 'minutes' | 'hours' | string;
|
|
5307
5350
|
}
|
|
5308
5351
|
|
|
5309
5352
|
export { Timestamp }
|
|
@@ -5405,6 +5448,8 @@ export declare class TopologyOpeningEvent {
|
|
|
5405
5448
|
|
|
5406
5449
|
/** @public */
|
|
5407
5450
|
export declare interface TopologyOptions extends BSONSerializeOptions, ServerOptions {
|
|
5451
|
+
srvMaxHosts: number;
|
|
5452
|
+
srvServiceName: string;
|
|
5408
5453
|
hosts: HostAddress[];
|
|
5409
5454
|
retryWrites: boolean;
|
|
5410
5455
|
retryReads: boolean;
|
|
@@ -5477,7 +5522,7 @@ export declare class Transaction {
|
|
|
5477
5522
|
*/
|
|
5478
5523
|
export declare interface TransactionOptions extends CommandOperationOptions {
|
|
5479
5524
|
/** A default read concern for commands in this transaction */
|
|
5480
|
-
readConcern?:
|
|
5525
|
+
readConcern?: ReadConcernLike;
|
|
5481
5526
|
/** A default writeConcern for commands in this transaction */
|
|
5482
5527
|
writeConcern?: WriteConcern;
|
|
5483
5528
|
/** A default read preference for commands in this transaction */
|
|
@@ -5912,6 +5957,8 @@ export declare class WriteError {
|
|
|
5912
5957
|
get index(): number;
|
|
5913
5958
|
/** WriteError message. */
|
|
5914
5959
|
get errmsg(): string | undefined;
|
|
5960
|
+
/** WriteError details. */
|
|
5961
|
+
get errInfo(): Document | undefined;
|
|
5915
5962
|
/** Returns the underlying operation that caused the error */
|
|
5916
5963
|
getOperation(): Document;
|
|
5917
5964
|
toJSON(): {
|