mongodb 4.1.0 → 4.1.4
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 +64 -32
- package/lib/admin.js +5 -5
- package/lib/admin.js.map +1 -1
- package/lib/bulk/common.js +93 -71
- package/lib/bulk/common.js.map +1 -1
- package/lib/change_stream.js +35 -27
- package/lib/change_stream.js.map +1 -1
- package/lib/cmap/auth/auth_provider.js +2 -2
- package/lib/cmap/auth/auth_provider.js.map +1 -1
- package/lib/cmap/auth/gssapi.js +3 -2
- package/lib/cmap/auth/gssapi.js.map +1 -1
- package/lib/cmap/auth/mongo_credentials.js +8 -7
- 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 +32 -32
- 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 +11 -8
- 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 +6 -6
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connect.js +5 -4
- package/lib/cmap/connect.js.map +1 -1
- package/lib/cmap/connection.js +27 -23
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/connection_pool.js +7 -5
- package/lib/cmap/connection_pool.js.map +1 -1
- package/lib/cmap/message_stream.js +3 -3
- 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/compression.js +22 -9
- package/lib/cmap/wire_protocol/compression.js.map +1 -1
- package/lib/collection.js +53 -48
- package/lib/collection.js.map +1 -1
- package/lib/connection_string.js +42 -36
- package/lib/connection_string.js.map +1 -1
- package/lib/cursor/abstract_cursor.js +18 -18
- package/lib/cursor/abstract_cursor.js.map +1 -1
- package/lib/cursor/aggregation_cursor.js +56 -15
- package/lib/cursor/aggregation_cursor.js.map +1 -1
- package/lib/cursor/find_cursor.js +63 -23
- package/lib/cursor/find_cursor.js.map +1 -1
- package/lib/db.js +35 -30
- package/lib/db.js.map +1 -1
- package/lib/deps.js +8 -1
- package/lib/deps.js.map +1 -1
- package/lib/error.js +16 -54
- package/lib/error.js.map +1 -1
- package/lib/gridfs/download.js +14 -24
- package/lib/gridfs/download.js.map +1 -1
- package/lib/gridfs/index.js +5 -5
- package/lib/gridfs/index.js.map +1 -1
- package/lib/gridfs/upload.js +13 -21
- package/lib/gridfs/upload.js.map +1 -1
- package/lib/index.js +22 -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 +9 -8
- 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 +2 -2
- 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 +4 -6
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/common_functions.js +2 -2
- package/lib/operations/common_functions.js.map +1 -1
- package/lib/operations/connect.js +3 -2
- 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 +5 -5
- 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 +10 -15
- package/lib/operations/execute_operation.js.map +1 -1
- package/lib/operations/find.js +8 -9
- 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 +8 -6
- package/lib/operations/insert.js.map +1 -1
- package/lib/operations/is_capped.js +2 -1
- package/lib/operations/is_capped.js.map +1 -1
- package/lib/operations/list_collections.js +4 -4
- 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 +1 -1
- package/lib/operations/operation.js.map +1 -1
- package/lib/operations/options_operation.js +2 -1
- package/lib/operations/options_operation.js.map +1 -1
- package/lib/operations/profiling_level.js +2 -2
- package/lib/operations/profiling_level.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 +2 -2
- 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/operations/validate_collection.js +4 -4
- package/lib/operations/validate_collection.js.map +1 -1
- package/lib/sdam/monitor.js +14 -14
- package/lib/sdam/monitor.js.map +1 -1
- package/lib/sdam/server.js +16 -17
- 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/srv_polling.js +1 -2
- package/lib/sdam/srv_polling.js.map +1 -1
- package/lib/sdam/topology.js +21 -18
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +1 -1
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +33 -33
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js +2 -2
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +15 -37
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +384 -121
- package/mongodb.ts34.d.ts +365 -124
- package/package.json +53 -58
- package/src/bulk/common.ts +105 -61
- package/src/change_stream.ts +41 -22
- package/src/cmap/auth/auth_provider.ts +3 -3
- package/src/cmap/auth/gssapi.ts +3 -2
- package/src/cmap/auth/mongo_credentials.ts +21 -10
- package/src/cmap/auth/mongodb_aws.ts +41 -36
- package/src/cmap/auth/scram.ts +6 -4
- package/src/cmap/command_monitoring_events.ts +1 -1
- package/src/cmap/commands.ts +6 -6
- package/src/cmap/connect.ts +5 -4
- package/src/cmap/connection.ts +15 -12
- package/src/cmap/connection_pool.ts +5 -3
- package/src/cmap/message_stream.ts +2 -4
- package/src/cmap/wire_protocol/compression.ts +26 -13
- package/src/collection.ts +54 -56
- package/src/connection_string.ts +37 -26
- package/src/cursor/abstract_cursor.ts +45 -35
- package/src/cursor/aggregation_cursor.ts +30 -9
- package/src/cursor/find_cursor.ts +27 -7
- package/src/db.ts +14 -14
- package/src/deps.ts +103 -23
- package/src/error.ts +33 -66
- package/src/gridfs/download.ts +37 -27
- package/src/gridfs/index.ts +3 -3
- package/src/gridfs/upload.ts +32 -33
- package/src/index.ts +34 -3
- package/src/mongo_client.ts +9 -13
- package/src/mongo_types.ts +22 -26
- package/src/operations/command.ts +2 -5
- package/src/operations/common_functions.ts +2 -3
- package/src/operations/connect.ts +3 -2
- package/src/operations/count.ts +1 -1
- package/src/operations/count_documents.ts +1 -1
- package/src/operations/distinct.ts +1 -1
- package/src/operations/eval.ts +1 -1
- package/src/operations/execute_operation.ts +9 -10
- package/src/operations/find.ts +7 -5
- package/src/operations/indexes.ts +2 -2
- package/src/operations/insert.ts +4 -1
- package/src/operations/is_capped.ts +3 -2
- package/src/operations/list_collections.ts +3 -1
- package/src/operations/list_databases.ts +6 -1
- package/src/operations/operation.ts +0 -1
- package/src/operations/options_operation.ts +3 -2
- package/src/operations/profiling_level.ts +3 -3
- package/src/operations/set_profiling_level.ts +2 -2
- package/src/operations/validate_collection.ts +5 -5
- package/src/sdam/server.ts +6 -7
- package/src/sdam/srv_polling.ts +2 -3
- package/src/sdam/topology.ts +15 -9
- package/src/sdam/topology_description.ts +2 -2
- package/src/sessions.ts +20 -16
- package/src/transactions.ts +3 -3
- package/src/utils.ts +20 -41
- package/HISTORY.md +0 -3026
- package/lib/operations/find_one.js +0 -34
- package/lib/operations/find_one.js.map +0 -1
- package/src/operations/find_one.ts +0 -43
package/mongodb.ts34.d.ts
CHANGED
|
@@ -67,24 +67,31 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
|
|
|
67
67
|
hasNext(): Promise<boolean>;
|
|
68
68
|
hasNext(callback: Callback<boolean>): void;
|
|
69
69
|
/** Get the next available document from the cursor, returns null if no more documents are available. */
|
|
70
|
-
next
|
|
71
|
-
next
|
|
70
|
+
next(): Promise<TSchema | null>;
|
|
71
|
+
next(callback: Callback<TSchema | null>): void;
|
|
72
|
+
next(callback?: Callback<TSchema | null>): Promise<TSchema | null> | void;
|
|
72
73
|
/**
|
|
73
74
|
* Try to get the next available document from the cursor or `null` if an empty batch is returned
|
|
74
75
|
*/
|
|
75
|
-
tryNext
|
|
76
|
-
tryNext
|
|
76
|
+
tryNext(): Promise<TSchema | null>;
|
|
77
|
+
tryNext(callback: Callback<TSchema | null>): void;
|
|
77
78
|
/**
|
|
78
79
|
* Iterates over all the documents for this cursor using the iterator, callback pattern.
|
|
79
80
|
*
|
|
80
81
|
* @param iterator - The iteration callback.
|
|
81
82
|
* @param callback - The end callback.
|
|
82
83
|
*/
|
|
83
|
-
forEach
|
|
84
|
-
forEach
|
|
85
|
-
close():
|
|
84
|
+
forEach(iterator: (doc: TSchema) => boolean | void): Promise<void>;
|
|
85
|
+
forEach(iterator: (doc: TSchema) => boolean | void, callback: Callback<void>): void;
|
|
86
|
+
close(): void;
|
|
86
87
|
close(callback: Callback): void;
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated options argument is deprecated
|
|
90
|
+
*/
|
|
87
91
|
close(options: CursorCloseOptions): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated options argument is deprecated
|
|
94
|
+
*/
|
|
88
95
|
close(options: CursorCloseOptions, callback: Callback): void;
|
|
89
96
|
/**
|
|
90
97
|
* Returns an array of documents. The caller is responsible for making sure that there
|
|
@@ -94,8 +101,8 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
|
|
|
94
101
|
*
|
|
95
102
|
* @param callback - The result callback.
|
|
96
103
|
*/
|
|
97
|
-
toArray
|
|
98
|
-
toArray
|
|
104
|
+
toArray(): Promise<TSchema[]>;
|
|
105
|
+
toArray(callback: Callback<TSchema[]>): void;
|
|
99
106
|
/**
|
|
100
107
|
* Add a cursor flag to the cursor
|
|
101
108
|
*
|
|
@@ -107,11 +114,12 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
|
|
|
107
114
|
* Map all documents using the provided function
|
|
108
115
|
* If there is a transform set on the cursor, that will be called first and the result passed to
|
|
109
116
|
* this function's transform.
|
|
110
|
-
* @remarks
|
|
111
117
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
|
|
120
|
+
* it **does not** return a new instance of a cursor. This means when calling map,
|
|
121
|
+
* you should always assign the result to a new variable in order to get a correctly typed cursor variable.
|
|
122
|
+
* Take note of the following example:
|
|
115
123
|
*
|
|
116
124
|
* @example
|
|
117
125
|
* ```typescript
|
|
@@ -383,8 +391,11 @@ export declare class AggregationCursor<TSchema = Document> extends AbstractCurso
|
|
|
383
391
|
limit($limit: number): this;
|
|
384
392
|
/** Add a match stage to the aggregation pipeline */
|
|
385
393
|
match($match: Document): this;
|
|
386
|
-
/** Add
|
|
387
|
-
out($out:
|
|
394
|
+
/** Add an out stage to the aggregation pipeline */
|
|
395
|
+
out($out: {
|
|
396
|
+
db: string;
|
|
397
|
+
coll: string;
|
|
398
|
+
} | string): this;
|
|
388
399
|
/**
|
|
389
400
|
* Add a project stage to the aggregation pipeline
|
|
390
401
|
*
|
|
@@ -392,18 +403,41 @@ export declare class AggregationCursor<TSchema = Document> extends AbstractCurso
|
|
|
392
403
|
* In order to strictly type this function you must provide an interface
|
|
393
404
|
* that represents the effect of your projection on the result documents.
|
|
394
405
|
*
|
|
395
|
-
*
|
|
406
|
+
* By default chaining a projection to your cursor changes the returned type to the generic {@link Document} type.
|
|
407
|
+
* You should specify a parameterized type to have assertions on your final results.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* // Best way
|
|
412
|
+
* const docs: AggregationCursor<{ a: number }> = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
413
|
+
* // Flexible way
|
|
414
|
+
* const docs: AggregationCursor<Document> = cursor.project({ _id: 0, a: true });
|
|
415
|
+
* ```
|
|
416
|
+
*
|
|
417
|
+
* @remarks
|
|
418
|
+
* In order to strictly type this function you must provide an interface
|
|
419
|
+
* that represents the effect of your projection on the result documents.
|
|
420
|
+
*
|
|
421
|
+
* **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
|
|
396
422
|
* it **does not** return a new instance of a cursor. This means when calling project,
|
|
397
|
-
* you should always assign the result to a new variable
|
|
423
|
+
* you should always assign the result to a new variable in order to get a correctly typed cursor variable.
|
|
424
|
+
* Take note of the following example:
|
|
398
425
|
*
|
|
399
426
|
* @example
|
|
400
427
|
* ```typescript
|
|
401
428
|
* const cursor: AggregationCursor<{ a: number; b: string }> = coll.aggregate([]);
|
|
402
|
-
* const projectCursor = cursor.project<{ a: number }>({ a: true });
|
|
429
|
+
* const projectCursor = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
403
430
|
* const aPropOnlyArray: {a: number}[] = await projectCursor.toArray();
|
|
431
|
+
*
|
|
432
|
+
* // or always use chaining and save the final cursor
|
|
433
|
+
*
|
|
434
|
+
* const cursor = coll.aggregate().project<{ a: string }>({
|
|
435
|
+
* _id: 0,
|
|
436
|
+
* a: { $convert: { input: '$a', to: 'string' }
|
|
437
|
+
* }});
|
|
404
438
|
* ```
|
|
405
439
|
*/
|
|
406
|
-
project<T =
|
|
440
|
+
project<T extends Document = Document>($project: Document): AggregationCursor<T>;
|
|
407
441
|
/** Add a lookup stage to the aggregation pipeline */
|
|
408
442
|
lookup($lookup: Document): this;
|
|
409
443
|
/** Add a redact stage to the aggregation pipeline */
|
|
@@ -471,6 +505,13 @@ export declare const AuthMechanism: Readonly<{
|
|
|
471
505
|
/** @public */
|
|
472
506
|
export declare type AuthMechanism = typeof AuthMechanism[keyof typeof AuthMechanism];
|
|
473
507
|
/** @public */
|
|
508
|
+
export declare interface AuthMechanismProperties extends Document {
|
|
509
|
+
SERVICE_NAME?: string;
|
|
510
|
+
SERVICE_REALM?: string;
|
|
511
|
+
CANONICALIZE_HOST_NAME?: boolean;
|
|
512
|
+
AWS_SESSION_TOKEN?: string;
|
|
513
|
+
}
|
|
514
|
+
/** @public */
|
|
474
515
|
export declare interface AutoEncrypter {
|
|
475
516
|
new (client: MongoClient, options: AutoEncryptionOptions): AutoEncrypter;
|
|
476
517
|
init(cb: Callback): void;
|
|
@@ -730,6 +771,7 @@ export declare interface BulkWriteOperationError {
|
|
|
730
771
|
index: number;
|
|
731
772
|
code: number;
|
|
732
773
|
errmsg: string;
|
|
774
|
+
errInfo: Document;
|
|
733
775
|
op: Document | UpdateStatement | DeleteStatement;
|
|
734
776
|
}
|
|
735
777
|
/** @public */
|
|
@@ -1258,10 +1300,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1258
1300
|
* @param options - Optional settings for the command
|
|
1259
1301
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1260
1302
|
*/
|
|
1261
|
-
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>): Promise<UpdateResult
|
|
1262
|
-
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>, callback: Callback<UpdateResult
|
|
1263
|
-
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>, options: UpdateOptions): Promise<UpdateResult
|
|
1264
|
-
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>, options: UpdateOptions, callback: Callback<UpdateResult
|
|
1303
|
+
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>): Promise<UpdateResult>;
|
|
1304
|
+
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>, callback: Callback<UpdateResult>): void;
|
|
1305
|
+
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>, options: UpdateOptions): Promise<UpdateResult>;
|
|
1306
|
+
updateOne(filter: Filter<TSchema>, update: UpdateFilter<TSchema> | Partial<TSchema>, options: UpdateOptions, callback: Callback<UpdateResult>): void;
|
|
1265
1307
|
/**
|
|
1266
1308
|
* Replace a document in a collection with another document
|
|
1267
1309
|
*
|
|
@@ -1339,25 +1381,25 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1339
1381
|
* @param options - Optional settings for the command
|
|
1340
1382
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1341
1383
|
*/
|
|
1342
|
-
findOne(): Promise<TSchema |
|
|
1343
|
-
findOne(callback: Callback<TSchema |
|
|
1344
|
-
findOne(filter: Filter<TSchema>): Promise<TSchema |
|
|
1345
|
-
findOne(filter: Filter<TSchema>, callback: Callback<TSchema |
|
|
1346
|
-
findOne(filter: Filter<TSchema>, options: FindOptions
|
|
1347
|
-
findOne(filter: Filter<TSchema>, options: FindOptions
|
|
1348
|
-
findOne<T = TSchema>(): Promise<T |
|
|
1349
|
-
findOne<T = TSchema>(callback: Callback<T |
|
|
1350
|
-
findOne<T = TSchema>(filter: Filter<
|
|
1351
|
-
findOne<T = TSchema>(filter: Filter<
|
|
1352
|
-
findOne<T = TSchema>(filter: Filter<
|
|
1384
|
+
findOne(): Promise<TSchema | null>;
|
|
1385
|
+
findOne(callback: Callback<TSchema | null>): void;
|
|
1386
|
+
findOne(filter: Filter<TSchema>): Promise<TSchema | null>;
|
|
1387
|
+
findOne(filter: Filter<TSchema>, callback: Callback<TSchema | null>): void;
|
|
1388
|
+
findOne(filter: Filter<TSchema>, options: FindOptions): Promise<TSchema | null>;
|
|
1389
|
+
findOne(filter: Filter<TSchema>, options: FindOptions, callback: Callback<TSchema | null>): void;
|
|
1390
|
+
findOne<T = TSchema>(): Promise<T | null>;
|
|
1391
|
+
findOne<T = TSchema>(callback: Callback<T | null>): void;
|
|
1392
|
+
findOne<T = TSchema>(filter: Filter<TSchema>): Promise<T | null>;
|
|
1393
|
+
findOne<T = TSchema>(filter: Filter<TSchema>, options?: FindOptions): Promise<T | null>;
|
|
1394
|
+
findOne<T = TSchema>(filter: Filter<TSchema>, options?: FindOptions, callback?: Callback<T | null>): void;
|
|
1353
1395
|
/**
|
|
1354
1396
|
* Creates a cursor for a filter that can be used to iterate over results from MongoDB
|
|
1355
1397
|
*
|
|
1356
1398
|
* @param filter - The filter predicate. If unspecified, then all documents in the collection will match the predicate
|
|
1357
1399
|
*/
|
|
1358
1400
|
find(): FindCursor<TSchema>;
|
|
1359
|
-
find(filter: Filter<TSchema>, options?: FindOptions
|
|
1360
|
-
find<T
|
|
1401
|
+
find(filter: Filter<TSchema>, options?: FindOptions): FindCursor<TSchema>;
|
|
1402
|
+
find<T>(filter: Filter<TSchema>, options?: FindOptions): FindCursor<T>;
|
|
1361
1403
|
/**
|
|
1362
1404
|
* Returns the options of the collection.
|
|
1363
1405
|
*
|
|
@@ -1564,10 +1606,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1564
1606
|
* @param options - Optional settings for the command
|
|
1565
1607
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1566
1608
|
*/
|
|
1567
|
-
indexes(): Promise<Document>;
|
|
1568
|
-
indexes(callback: Callback<Document>): void;
|
|
1569
|
-
indexes(options: IndexInformationOptions): Promise<Document>;
|
|
1570
|
-
indexes(options: IndexInformationOptions, callback: Callback<Document>): void;
|
|
1609
|
+
indexes(): Promise<Document[]>;
|
|
1610
|
+
indexes(callback: Callback<Document[]>): void;
|
|
1611
|
+
indexes(options: IndexInformationOptions): Promise<Document[]>;
|
|
1612
|
+
indexes(options: IndexInformationOptions, callback: Callback<Document[]>): void;
|
|
1571
1613
|
/**
|
|
1572
1614
|
* Get all the collection statistics.
|
|
1573
1615
|
*
|
|
@@ -1619,7 +1661,7 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1619
1661
|
* @param pipeline - An array of aggregation pipelines to execute
|
|
1620
1662
|
* @param options - Optional settings for the command
|
|
1621
1663
|
*/
|
|
1622
|
-
aggregate<T =
|
|
1664
|
+
aggregate<T = Document>(pipeline?: Document[], options?: AggregateOptions): AggregationCursor<T>;
|
|
1623
1665
|
/**
|
|
1624
1666
|
* Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection.
|
|
1625
1667
|
*
|
|
@@ -1793,7 +1835,7 @@ export declare class CommandFailedEvent {
|
|
|
1793
1835
|
/* Excluded from this release type: CommandOperation */
|
|
1794
1836
|
/** @public */
|
|
1795
1837
|
export declare interface CommandOperationOptions extends OperationOptions, WriteConcernOptions, ExplainOptions {
|
|
1796
|
-
/**
|
|
1838
|
+
/** @deprecated This option does nothing */
|
|
1797
1839
|
fullResponse?: boolean;
|
|
1798
1840
|
/** Specify a read concern and level for the collection. (only MongoDB 3.2 or higher supported) */
|
|
1799
1841
|
readConcern?: ReadConcernLike;
|
|
@@ -1808,23 +1850,7 @@ export declare interface CommandOperationOptions extends OperationOptions, Write
|
|
|
1808
1850
|
authdb?: string;
|
|
1809
1851
|
noResponse?: boolean;
|
|
1810
1852
|
}
|
|
1811
|
-
|
|
1812
|
-
export declare interface CommandOptions extends BSONSerializeOptions {
|
|
1813
|
-
command?: boolean;
|
|
1814
|
-
slaveOk?: boolean;
|
|
1815
|
-
/** Specify read preference if command supports it */
|
|
1816
|
-
readPreference?: ReadPreferenceLike;
|
|
1817
|
-
raw?: boolean;
|
|
1818
|
-
monitoring?: boolean;
|
|
1819
|
-
fullResult?: boolean;
|
|
1820
|
-
socketTimeoutMS?: number;
|
|
1821
|
-
/** Session to use for the operation */
|
|
1822
|
-
session?: ClientSession;
|
|
1823
|
-
documentsReturnedIn?: string;
|
|
1824
|
-
noResponse?: boolean;
|
|
1825
|
-
willRetryWrite?: boolean;
|
|
1826
|
-
writeConcern?: WriteConcernOptions | WriteConcern | W;
|
|
1827
|
-
}
|
|
1853
|
+
/* Excluded from this release type: CommandOptions */
|
|
1828
1854
|
/**
|
|
1829
1855
|
* An event indicating the start of a given
|
|
1830
1856
|
* @public
|
|
@@ -2130,9 +2156,11 @@ export declare const CURSOR_FLAGS: readonly [
|
|
|
2130
2156
|
"exhaust",
|
|
2131
2157
|
"partial"
|
|
2132
2158
|
];
|
|
2133
|
-
/** @public
|
|
2159
|
+
/** @public
|
|
2160
|
+
* @deprecated This interface is deprecated */
|
|
2134
2161
|
export declare interface CursorCloseOptions {
|
|
2135
2162
|
/** Bypass calling killCursors when closing the cursor. */
|
|
2163
|
+
/** @deprecated the skipKillCursors option is deprecated */
|
|
2136
2164
|
skipKillCursors?: boolean;
|
|
2137
2165
|
}
|
|
2138
2166
|
/** @public */
|
|
@@ -2221,7 +2249,7 @@ export declare class Db {
|
|
|
2221
2249
|
* @param pipeline - An array of aggregation stages to be executed
|
|
2222
2250
|
* @param options - Optional settings for the command
|
|
2223
2251
|
*/
|
|
2224
|
-
aggregate(pipeline?: Document[], options?: AggregateOptions): AggregationCursor
|
|
2252
|
+
aggregate<T = Document>(pipeline?: Document[], options?: AggregateOptions): AggregationCursor<T>;
|
|
2225
2253
|
/** Return the Admin db instance */
|
|
2226
2254
|
admin(): Admin;
|
|
2227
2255
|
/**
|
|
@@ -2230,7 +2258,7 @@ export declare class Db {
|
|
|
2230
2258
|
* @param name - the collection name we wish to access.
|
|
2231
2259
|
* @returns return the new Collection instance
|
|
2232
2260
|
*/
|
|
2233
|
-
collection<TSchema extends Document = Document>(name: string): Collection<TSchema>;
|
|
2261
|
+
collection<TSchema extends Document = Document>(name: string, options?: CollectionOptions): Collection<TSchema>;
|
|
2234
2262
|
/**
|
|
2235
2263
|
* Get all the db statistics.
|
|
2236
2264
|
*
|
|
@@ -2371,7 +2399,10 @@ export declare class Db {
|
|
|
2371
2399
|
indexInformation(name: string, callback: Callback<Document>): void;
|
|
2372
2400
|
indexInformation(name: string, options: IndexInformationOptions): Promise<Document>;
|
|
2373
2401
|
indexInformation(name: string, options: IndexInformationOptions, callback: Callback<Document>): void;
|
|
2374
|
-
/**
|
|
2402
|
+
/**
|
|
2403
|
+
* Unref all sockets
|
|
2404
|
+
* @deprecated This function is deprecated and will be removed in the next major version.
|
|
2405
|
+
*/
|
|
2375
2406
|
unref(): void;
|
|
2376
2407
|
/**
|
|
2377
2408
|
* Create a new Change Stream, watching for new changes (insertions, updates,
|
|
@@ -2496,12 +2527,12 @@ export declare interface EndSessionOptions {
|
|
|
2496
2527
|
/** TypeScript Omit (Exclude to be specific) does not work for objects with an "any" indexed type, and breaks discriminated unions @public */
|
|
2497
2528
|
export declare type EnhancedOmit<TRecordOrUnion, KeyUnion> = string extends keyof TRecordOrUnion ? TRecordOrUnion : TRecordOrUnion extends any ? Pick<TRecordOrUnion, Exclude<keyof TRecordOrUnion, KeyUnion>> : never;
|
|
2498
2529
|
/** @public */
|
|
2499
|
-
export declare interface ErrorDescription {
|
|
2530
|
+
export declare interface ErrorDescription extends Document {
|
|
2500
2531
|
message?: string;
|
|
2501
2532
|
errmsg?: string;
|
|
2502
2533
|
$err?: string;
|
|
2503
2534
|
errorLabels?: string[];
|
|
2504
|
-
|
|
2535
|
+
errInfo?: Document;
|
|
2505
2536
|
}
|
|
2506
2537
|
/** @public */
|
|
2507
2538
|
export declare interface EstimatedDocumentCountOptions extends CommandOperationOptions {
|
|
@@ -2682,18 +2713,40 @@ export declare class FindCursor<TSchema = Document> extends AbstractCursor<TSche
|
|
|
2682
2713
|
* In order to strictly type this function you must provide an interface
|
|
2683
2714
|
* that represents the effect of your projection on the result documents.
|
|
2684
2715
|
*
|
|
2685
|
-
*
|
|
2716
|
+
* By default chaining a projection to your cursor changes the returned type to the generic
|
|
2717
|
+
* {@link Document} type.
|
|
2718
|
+
* You should specify a parameterized type to have assertions on your final results.
|
|
2719
|
+
*
|
|
2720
|
+
* @example
|
|
2721
|
+
* ```typescript
|
|
2722
|
+
* // Best way
|
|
2723
|
+
* const docs: FindCursor<{ a: number }> = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
2724
|
+
* // Flexible way
|
|
2725
|
+
* const docs: FindCursor<Document> = cursor.project({ _id: 0, a: true });
|
|
2726
|
+
* ```
|
|
2727
|
+
*
|
|
2728
|
+
* @remarks
|
|
2729
|
+
*
|
|
2730
|
+
* **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
|
|
2686
2731
|
* it **does not** return a new instance of a cursor. This means when calling project,
|
|
2687
|
-
* you should always assign the result to a new variable
|
|
2732
|
+
* you should always assign the result to a new variable in order to get a correctly typed cursor variable.
|
|
2733
|
+
* Take note of the following example:
|
|
2688
2734
|
*
|
|
2689
2735
|
* @example
|
|
2690
2736
|
* ```typescript
|
|
2691
2737
|
* const cursor: FindCursor<{ a: number; b: string }> = coll.find();
|
|
2692
|
-
* const projectCursor = cursor.project<{ a: number }>({ a: true });
|
|
2738
|
+
* const projectCursor = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
2693
2739
|
* const aPropOnlyArray: {a: number}[] = await projectCursor.toArray();
|
|
2740
|
+
*
|
|
2741
|
+
* // or always use chaining and save the final cursor
|
|
2742
|
+
*
|
|
2743
|
+
* const cursor = coll.find().project<{ a: string }>({
|
|
2744
|
+
* _id: 0,
|
|
2745
|
+
* a: { $convert: { input: '$a', to: 'string' }
|
|
2746
|
+
* }});
|
|
2694
2747
|
* ```
|
|
2695
2748
|
*/
|
|
2696
|
-
project<T =
|
|
2749
|
+
project<T extends Document = Document>(value: Document): FindCursor<T>;
|
|
2697
2750
|
/**
|
|
2698
2751
|
* Sets the sort order of the cursor query.
|
|
2699
2752
|
*
|
|
@@ -2800,14 +2853,17 @@ export declare class FindOperators {
|
|
|
2800
2853
|
/** Specifies arrayFilters for UpdateOne or UpdateMany bulk operations. */
|
|
2801
2854
|
arrayFilters(arrayFilters: Document[]): this;
|
|
2802
2855
|
}
|
|
2803
|
-
/**
|
|
2804
|
-
|
|
2856
|
+
/**
|
|
2857
|
+
* @public
|
|
2858
|
+
* @typeParam TSchema - Unused schema definition, deprecated usage, only specify `FindOptions` with no generic
|
|
2859
|
+
*/
|
|
2860
|
+
export declare interface FindOptions<TSchema extends Document = Document> extends CommandOperationOptions {
|
|
2805
2861
|
/** Sets the limit of documents returned in the query. */
|
|
2806
2862
|
limit?: number;
|
|
2807
2863
|
/** Set to sort the documents coming back from the query. Array of indexes, `[['a', 1]]` etc. */
|
|
2808
2864
|
sort?: Sort;
|
|
2809
2865
|
/** The fields to return in the query. Object of fields to either include or exclude (one of, not both), `{'a':1, 'b': 1}` **or** `{'a': 0, 'b': 0}` */
|
|
2810
|
-
projection?:
|
|
2866
|
+
projection?: Document;
|
|
2811
2867
|
/** Set to skip N documents ahead in your query (useful for pagination). */
|
|
2812
2868
|
skip?: number;
|
|
2813
2869
|
/** Tell the query to use specific indexes in the query. Object of indexes to use, `{'_id':1}` */
|
|
@@ -2937,7 +2993,7 @@ export declare interface GridFSBucketOptions extends WriteConcernOptions {
|
|
|
2937
2993
|
* Do not instantiate this class directly. Use `openDownloadStream()` instead.
|
|
2938
2994
|
* @public
|
|
2939
2995
|
*/
|
|
2940
|
-
export declare class GridFSBucketReadStream extends Readable {
|
|
2996
|
+
export declare class GridFSBucketReadStream extends Readable implements NodeJS.ReadableStream {
|
|
2941
2997
|
/* Excluded from this release type: s */
|
|
2942
2998
|
/**
|
|
2943
2999
|
* An error occurred
|
|
@@ -3014,7 +3070,7 @@ export declare interface GridFSBucketReadStreamOptionsWithRevision extends GridF
|
|
|
3014
3070
|
* Do not instantiate this class directly. Use `openUploadStream()` instead.
|
|
3015
3071
|
* @public
|
|
3016
3072
|
*/
|
|
3017
|
-
export declare class GridFSBucketWriteStream extends Writable {
|
|
3073
|
+
export declare class GridFSBucketWriteStream extends Writable implements NodeJS.WritableStream {
|
|
3018
3074
|
bucket: GridFSBucket;
|
|
3019
3075
|
chunks: Collection<GridFSChunk>;
|
|
3020
3076
|
filename: string;
|
|
@@ -3052,10 +3108,10 @@ export declare class GridFSBucketWriteStream extends Writable {
|
|
|
3052
3108
|
* @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.
|
|
3053
3109
|
* @returns False if this write required flushing a chunk to MongoDB. True otherwise.
|
|
3054
3110
|
*/
|
|
3055
|
-
write(chunk: Buffer): boolean;
|
|
3056
|
-
write(chunk: Buffer, callback: Callback<void>): boolean;
|
|
3057
|
-
write(chunk: Buffer, encoding: BufferEncoding | undefined): boolean;
|
|
3058
|
-
write(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<void>): boolean;
|
|
3111
|
+
write(chunk: Buffer | string): boolean;
|
|
3112
|
+
write(chunk: Buffer | string, callback: Callback<void>): boolean;
|
|
3113
|
+
write(chunk: Buffer | string, encoding: BufferEncoding | undefined): boolean;
|
|
3114
|
+
write(chunk: Buffer | string, encoding: BufferEncoding | undefined, callback: Callback<void>): boolean;
|
|
3059
3115
|
/**
|
|
3060
3116
|
* Places this write stream into an aborted state (all future writes fail)
|
|
3061
3117
|
* and deletes all chunks that have already been written.
|
|
@@ -3226,6 +3282,7 @@ export declare type KeysOfOtherType<TSchema, Type> = {
|
|
|
3226
3282
|
[key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? never : key;
|
|
3227
3283
|
}[keyof TSchema];
|
|
3228
3284
|
/* Excluded from this release type: kFilter */
|
|
3285
|
+
/* Excluded from this release type: kFullResult */
|
|
3229
3286
|
/* Excluded from this release type: kGeneration */
|
|
3230
3287
|
/* Excluded from this release type: kGeneration_2 */
|
|
3231
3288
|
/* Excluded from this release type: kId */
|
|
@@ -3258,6 +3315,7 @@ export declare type KeysOfOtherType<TSchema, Type> = {
|
|
|
3258
3315
|
/* Excluded from this release type: kRTTPinger */
|
|
3259
3316
|
/* Excluded from this release type: kServer */
|
|
3260
3317
|
/* Excluded from this release type: kServer_2 */
|
|
3318
|
+
/* Excluded from this release type: kServerError */
|
|
3261
3319
|
/* Excluded from this release type: kServerSession */
|
|
3262
3320
|
/* Excluded from this release type: kServiceGenerations */
|
|
3263
3321
|
/* Excluded from this release type: kSession */
|
|
@@ -3297,7 +3355,7 @@ export declare const LEGAL_TLS_SOCKET_OPTIONS: readonly [
|
|
|
3297
3355
|
"session"
|
|
3298
3356
|
];
|
|
3299
3357
|
/** @public */
|
|
3300
|
-
export declare class ListCollectionsCursor<T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo = CollectionInfo> extends AbstractCursor<T> {
|
|
3358
|
+
export declare class ListCollectionsCursor<T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo = Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo> extends AbstractCursor<T> {
|
|
3301
3359
|
parent: Db;
|
|
3302
3360
|
filter: Document;
|
|
3303
3361
|
options?: ListCollectionsOptions;
|
|
@@ -3321,7 +3379,16 @@ export declare interface ListDatabasesOptions extends CommandOperationOptions {
|
|
|
3321
3379
|
authorizedDatabases?: boolean;
|
|
3322
3380
|
}
|
|
3323
3381
|
/** @public */
|
|
3324
|
-
export declare
|
|
3382
|
+
export declare interface ListDatabasesResult {
|
|
3383
|
+
databases: ({
|
|
3384
|
+
name: string;
|
|
3385
|
+
sizeOnDisk?: number;
|
|
3386
|
+
empty?: boolean;
|
|
3387
|
+
} & Document)[];
|
|
3388
|
+
totalSize?: number;
|
|
3389
|
+
totalSizeMb?: number;
|
|
3390
|
+
ok: 1 | 0;
|
|
3391
|
+
}
|
|
3325
3392
|
/** @public */
|
|
3326
3393
|
export declare class ListIndexesCursor extends AbstractCursor {
|
|
3327
3394
|
parent: Collection;
|
|
@@ -3469,7 +3536,7 @@ export { MaxKey };
|
|
|
3469
3536
|
export { MinKey };
|
|
3470
3537
|
/** @public */
|
|
3471
3538
|
export declare interface ModifyResult<TSchema = Document> {
|
|
3472
|
-
value
|
|
3539
|
+
value: TSchema | null;
|
|
3473
3540
|
lastErrorObject?: Document;
|
|
3474
3541
|
ok: 0 | 1;
|
|
3475
3542
|
}
|
|
@@ -3497,7 +3564,18 @@ export declare const MONGO_CLIENT_EVENTS: readonly [
|
|
|
3497
3564
|
* @category Error
|
|
3498
3565
|
*/
|
|
3499
3566
|
export declare class MongoAPIError extends MongoDriverError {
|
|
3500
|
-
|
|
3567
|
+
constructor(message: string);
|
|
3568
|
+
readonly name: string;
|
|
3569
|
+
}
|
|
3570
|
+
/**
|
|
3571
|
+
* An error generated when a batch command is reexecuted after one of the commands in the batch
|
|
3572
|
+
* has failed
|
|
3573
|
+
*
|
|
3574
|
+
* @public
|
|
3575
|
+
* @category Error
|
|
3576
|
+
*/
|
|
3577
|
+
export declare class MongoBatchReExecutionError extends MongoAPIError {
|
|
3578
|
+
constructor(message?: string);
|
|
3501
3579
|
readonly name: string;
|
|
3502
3580
|
}
|
|
3503
3581
|
/**
|
|
@@ -3507,8 +3585,14 @@ export declare class MongoAPIError extends MongoDriverError {
|
|
|
3507
3585
|
*/
|
|
3508
3586
|
export declare class MongoBulkWriteError extends MongoServerError {
|
|
3509
3587
|
result: BulkWriteResult;
|
|
3588
|
+
writeErrors: OneOrMore<WriteError>;
|
|
3589
|
+
err?: WriteConcernError;
|
|
3510
3590
|
/** Creates a new MongoBulkWriteError */
|
|
3511
|
-
constructor(error:
|
|
3591
|
+
constructor(error: {
|
|
3592
|
+
message: string;
|
|
3593
|
+
code: number;
|
|
3594
|
+
writeErrors?: WriteError[];
|
|
3595
|
+
} | WriteConcernError | AnyError, result: BulkWriteResult);
|
|
3512
3596
|
readonly name: string;
|
|
3513
3597
|
/*Number of documents inserted. */
|
|
3514
3598
|
readonly insertedCount: number;
|
|
@@ -3529,6 +3613,16 @@ export declare class MongoBulkWriteError extends MongoServerError {
|
|
|
3529
3613
|
[key: number]: any;
|
|
3530
3614
|
};
|
|
3531
3615
|
}
|
|
3616
|
+
/**
|
|
3617
|
+
* An error generated when a ChangeStream operation fails to execute.
|
|
3618
|
+
*
|
|
3619
|
+
* @public
|
|
3620
|
+
* @category Error
|
|
3621
|
+
*/
|
|
3622
|
+
export declare class MongoChangeStreamError extends MongoRuntimeError {
|
|
3623
|
+
constructor(message: string);
|
|
3624
|
+
readonly name: string;
|
|
3625
|
+
}
|
|
3532
3626
|
/**
|
|
3533
3627
|
* The **MongoClient** class is a class that allows for making Connections to MongoDB.
|
|
3534
3628
|
* @public
|
|
@@ -3664,7 +3758,7 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
3664
3758
|
ssl?: boolean;
|
|
3665
3759
|
/** Specifies the location of a local TLS Certificate */
|
|
3666
3760
|
tlsCertificateFile?: string;
|
|
3667
|
-
/** Specifies the location of a local .pem file that contains either the client
|
|
3761
|
+
/** 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. */
|
|
3668
3762
|
tlsCertificateKeyFile?: string;
|
|
3669
3763
|
/** Specifies the password to de-crypt the tlsCertificateKeyFile. */
|
|
3670
3764
|
tlsCertificateKeyFilePassword?: string;
|
|
@@ -3680,8 +3774,8 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
3680
3774
|
connectTimeoutMS?: number;
|
|
3681
3775
|
/** The time in milliseconds to attempt a send or receive on a socket before the attempt times out. */
|
|
3682
3776
|
socketTimeoutMS?: number;
|
|
3683
|
-
/**
|
|
3684
|
-
compressors?: CompressorName[];
|
|
3777
|
+
/** An array or comma-delimited string of compressors to enable network compression for communication between this client and a mongod/mongos instance. */
|
|
3778
|
+
compressors?: CompressorName[] | string;
|
|
3685
3779
|
/** An integer that specifies the compression level if using zlib for network compression. */
|
|
3686
3780
|
zlibCompressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
|
|
3687
3781
|
/** The maximum number of connections in the connection pool. */
|
|
@@ -3709,12 +3803,7 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
3709
3803
|
/** Specify the authentication mechanism that MongoDB will use to authenticate the connection. */
|
|
3710
3804
|
authMechanism?: AuthMechanism;
|
|
3711
3805
|
/** Specify properties for the specified authMechanism as a comma-separated list of colon-separated key-value pairs. */
|
|
3712
|
-
authMechanismProperties?:
|
|
3713
|
-
SERVICE_NAME?: string;
|
|
3714
|
-
CANONICALIZE_HOST_NAME?: boolean;
|
|
3715
|
-
SERVICE_REALM?: string;
|
|
3716
|
-
[key: string]: any;
|
|
3717
|
-
};
|
|
3806
|
+
authMechanismProperties?: AuthMechanismProperties;
|
|
3718
3807
|
/** The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances. */
|
|
3719
3808
|
localThresholdMS?: number;
|
|
3720
3809
|
/** Specifies how long (in milliseconds) to block for server selection before throwing an exception. */
|
|
@@ -3819,7 +3908,7 @@ export declare class MongoCredentials {
|
|
|
3819
3908
|
/** The method used to authenticate */
|
|
3820
3909
|
readonly mechanism: AuthMechanism;
|
|
3821
3910
|
/** Special properties used by some types of auth mechanisms */
|
|
3822
|
-
readonly mechanismProperties:
|
|
3911
|
+
readonly mechanismProperties: AuthMechanismProperties;
|
|
3823
3912
|
constructor(options: MongoCredentialsOptions);
|
|
3824
3913
|
/** Determines if two MongoCredentials objects are equivalent */
|
|
3825
3914
|
equals(other: MongoCredentials): boolean;
|
|
@@ -3840,7 +3929,28 @@ export declare interface MongoCredentialsOptions {
|
|
|
3840
3929
|
source: string;
|
|
3841
3930
|
db?: string;
|
|
3842
3931
|
mechanism?: AuthMechanism;
|
|
3843
|
-
mechanismProperties:
|
|
3932
|
+
mechanismProperties: AuthMechanismProperties;
|
|
3933
|
+
}
|
|
3934
|
+
/**
|
|
3935
|
+
* An error thrown when an attempt is made to read from a cursor that has been exhausted
|
|
3936
|
+
*
|
|
3937
|
+
* @public
|
|
3938
|
+
* @category Error
|
|
3939
|
+
*/
|
|
3940
|
+
export declare class MongoCursorExhaustedError extends MongoAPIError {
|
|
3941
|
+
constructor(message?: string);
|
|
3942
|
+
readonly name: string;
|
|
3943
|
+
}
|
|
3944
|
+
/**
|
|
3945
|
+
* An error thrown when the user attempts to add options to a cursor that has already been
|
|
3946
|
+
* initialized
|
|
3947
|
+
*
|
|
3948
|
+
* @public
|
|
3949
|
+
* @category Error
|
|
3950
|
+
*/
|
|
3951
|
+
export declare class MongoCursorInUseError extends MongoAPIError {
|
|
3952
|
+
constructor(message?: string);
|
|
3953
|
+
readonly name: string;
|
|
3844
3954
|
}
|
|
3845
3955
|
/** @public */
|
|
3846
3956
|
export declare class MongoDBNamespace {
|
|
@@ -3857,6 +3967,17 @@ export declare class MongoDBNamespace {
|
|
|
3857
3967
|
withCollection(collection: string): MongoDBNamespace;
|
|
3858
3968
|
static fromString(namespace?: string): MongoDBNamespace;
|
|
3859
3969
|
}
|
|
3970
|
+
/**
|
|
3971
|
+
* An error generated when the driver fails to decompress
|
|
3972
|
+
* data received from the server.
|
|
3973
|
+
*
|
|
3974
|
+
* @public
|
|
3975
|
+
* @category Error
|
|
3976
|
+
*/
|
|
3977
|
+
export declare class MongoDecompressionError extends MongoRuntimeError {
|
|
3978
|
+
constructor(message: string);
|
|
3979
|
+
readonly name: string;
|
|
3980
|
+
}
|
|
3860
3981
|
/**
|
|
3861
3982
|
* An error generated by the driver
|
|
3862
3983
|
*
|
|
@@ -3864,7 +3985,6 @@ export declare class MongoDBNamespace {
|
|
|
3864
3985
|
* @category Error
|
|
3865
3986
|
*/
|
|
3866
3987
|
export declare class MongoDriverError extends MongoError {
|
|
3867
|
-
code?: string;
|
|
3868
3988
|
constructor(message: string);
|
|
3869
3989
|
readonly name: string;
|
|
3870
3990
|
}
|
|
@@ -3877,6 +3997,11 @@ export declare class MongoDriverError extends MongoError {
|
|
|
3877
3997
|
*/
|
|
3878
3998
|
export declare class MongoError extends Error {
|
|
3879
3999
|
/* Excluded from this release type: [kErrorLabels] */
|
|
4000
|
+
/**
|
|
4001
|
+
* This is a number in MongoServerError and a string in MongoDriverError
|
|
4002
|
+
* @privateRemarks
|
|
4003
|
+
* Define the type override on the subclasses when we can use the override keyword
|
|
4004
|
+
*/
|
|
3880
4005
|
code?: number | string;
|
|
3881
4006
|
topologyVersion?: TopologyVersion;
|
|
3882
4007
|
constructor(message: string | Error);
|
|
@@ -3893,6 +4018,37 @@ export declare class MongoError extends Error {
|
|
|
3893
4018
|
addErrorLabel(label: string): void;
|
|
3894
4019
|
readonly errorLabels: string[];
|
|
3895
4020
|
}
|
|
4021
|
+
/**
|
|
4022
|
+
* An error generated when the user attempts to operate
|
|
4023
|
+
* on a session that has expired or has been closed.
|
|
4024
|
+
*
|
|
4025
|
+
* @public
|
|
4026
|
+
* @category Error
|
|
4027
|
+
*/
|
|
4028
|
+
export declare class MongoExpiredSessionError extends MongoAPIError {
|
|
4029
|
+
constructor(message?: string);
|
|
4030
|
+
readonly name: string;
|
|
4031
|
+
}
|
|
4032
|
+
/**
|
|
4033
|
+
* An error generated when a malformed or invalid chunk is
|
|
4034
|
+
* encountered when reading from a GridFSStream.
|
|
4035
|
+
*
|
|
4036
|
+
* @public
|
|
4037
|
+
* @category Error
|
|
4038
|
+
*/
|
|
4039
|
+
export declare class MongoGridFSChunkError extends MongoRuntimeError {
|
|
4040
|
+
constructor(message: string);
|
|
4041
|
+
readonly name: string;
|
|
4042
|
+
}
|
|
4043
|
+
/** An error generated when a GridFSStream operation fails to execute.
|
|
4044
|
+
*
|
|
4045
|
+
* @public
|
|
4046
|
+
* @category Error
|
|
4047
|
+
*/
|
|
4048
|
+
export declare class MongoGridFSStreamError extends MongoRuntimeError {
|
|
4049
|
+
constructor(message: string);
|
|
4050
|
+
readonly name: string;
|
|
4051
|
+
}
|
|
3896
4052
|
/**
|
|
3897
4053
|
* An error generated when the user supplies malformed or unexpected arguments
|
|
3898
4054
|
* or when a required argument or field is not provided.
|
|
@@ -3905,6 +4061,17 @@ export declare class MongoInvalidArgumentError extends MongoAPIError {
|
|
|
3905
4061
|
constructor(message: string);
|
|
3906
4062
|
readonly name: string;
|
|
3907
4063
|
}
|
|
4064
|
+
/**
|
|
4065
|
+
* A error generated when the user attempts to authenticate
|
|
4066
|
+
* via Kerberos, but fails to connect to the Kerberos client.
|
|
4067
|
+
*
|
|
4068
|
+
* @public
|
|
4069
|
+
* @category Error
|
|
4070
|
+
*/
|
|
4071
|
+
export declare class MongoKerberosError extends MongoRuntimeError {
|
|
4072
|
+
constructor(message: string);
|
|
4073
|
+
readonly name: string;
|
|
4074
|
+
}
|
|
3908
4075
|
/**
|
|
3909
4076
|
* An error generated when the user fails to provide authentication credentials before attempting
|
|
3910
4077
|
* to connect to a mongo server instance.
|
|
@@ -3954,11 +4121,22 @@ export declare class MongoNetworkTimeoutError extends MongoNetworkError {
|
|
|
3954
4121
|
constructor(message: string, options?: MongoNetworkErrorOptions);
|
|
3955
4122
|
readonly name: string;
|
|
3956
4123
|
}
|
|
4124
|
+
/**
|
|
4125
|
+
* An error thrown when the user attempts to operate on a database or collection through a MongoClient
|
|
4126
|
+
* that has not yet successfully called the "connect" method
|
|
4127
|
+
*
|
|
4128
|
+
* @public
|
|
4129
|
+
* @category Error
|
|
4130
|
+
*/
|
|
4131
|
+
export declare class MongoNotConnectedError extends MongoAPIError {
|
|
4132
|
+
constructor(message: string);
|
|
4133
|
+
readonly name: string;
|
|
4134
|
+
}
|
|
3957
4135
|
/**
|
|
3958
4136
|
* Mongo Client Options
|
|
3959
4137
|
* @public
|
|
3960
4138
|
*/
|
|
3961
|
-
export declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEncryption' | '
|
|
4139
|
+
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' | 'tlsAllowInvalidCertificates' | 'tlsAllowInvalidHostnames' | 'tlsInsecure' | 'waitQueueTimeoutMS' | 'zlibCompressionLevel'>>, SupportedNodeConnectionOptions {
|
|
3962
4140
|
hosts: HostAddress[];
|
|
3963
4141
|
srvHost?: string;
|
|
3964
4142
|
credentials?: MongoCredentials;
|
|
@@ -3966,6 +4144,7 @@ export declare interface MongoOptions extends Required<Pick<MongoClientOptions,
|
|
|
3966
4144
|
readConcern: ReadConcern;
|
|
3967
4145
|
loadBalanced: boolean;
|
|
3968
4146
|
serverApi: ServerApi;
|
|
4147
|
+
compressors: CompressorName[];
|
|
3969
4148
|
writeConcern: WriteConcern;
|
|
3970
4149
|
dbName: string;
|
|
3971
4150
|
metadata: ClientMetadata;
|
|
@@ -4006,6 +4185,31 @@ export declare class MongoParseError extends MongoDriverError {
|
|
|
4006
4185
|
constructor(message: string);
|
|
4007
4186
|
readonly name: string;
|
|
4008
4187
|
}
|
|
4188
|
+
/**
|
|
4189
|
+
* An error generated when the driver encounters unexpected input
|
|
4190
|
+
* or reaches an unexpected/invalid internal state
|
|
4191
|
+
*
|
|
4192
|
+
* @privateRemarks
|
|
4193
|
+
* Should **never** be directly instantiated.
|
|
4194
|
+
*
|
|
4195
|
+
* @public
|
|
4196
|
+
* @category Error
|
|
4197
|
+
*/
|
|
4198
|
+
export declare class MongoRuntimeError extends MongoDriverError {
|
|
4199
|
+
constructor(message: string);
|
|
4200
|
+
readonly name: string;
|
|
4201
|
+
}
|
|
4202
|
+
/**
|
|
4203
|
+
* An error generated when an attempt is made to operate
|
|
4204
|
+
* on a closed/closing server.
|
|
4205
|
+
*
|
|
4206
|
+
* @public
|
|
4207
|
+
* @category Error
|
|
4208
|
+
*/
|
|
4209
|
+
export declare class MongoServerClosedError extends MongoAPIError {
|
|
4210
|
+
constructor(message?: string);
|
|
4211
|
+
readonly name: string;
|
|
4212
|
+
}
|
|
4009
4213
|
/**
|
|
4010
4214
|
* An error coming from the mongo server
|
|
4011
4215
|
*
|
|
@@ -4013,10 +4217,12 @@ export declare class MongoParseError extends MongoDriverError {
|
|
|
4013
4217
|
* @category Error
|
|
4014
4218
|
*/
|
|
4015
4219
|
export declare class MongoServerError extends MongoError {
|
|
4016
|
-
code?: number;
|
|
4017
4220
|
codeName?: string;
|
|
4018
4221
|
writeConcernError?: Document;
|
|
4019
|
-
|
|
4222
|
+
errInfo?: Document;
|
|
4223
|
+
ok?: number;
|
|
4224
|
+
[key: string]: any;
|
|
4225
|
+
constructor(message: ErrorDescription);
|
|
4020
4226
|
readonly name: string;
|
|
4021
4227
|
}
|
|
4022
4228
|
/**
|
|
@@ -4039,6 +4245,28 @@ export declare class MongoSystemError extends MongoError {
|
|
|
4039
4245
|
constructor(message: string, reason: TopologyDescription);
|
|
4040
4246
|
readonly name: string;
|
|
4041
4247
|
}
|
|
4248
|
+
/**
|
|
4249
|
+
* An error generated when an attempt is made to operate on a
|
|
4250
|
+
* dropped, or otherwise unavailable, database.
|
|
4251
|
+
*
|
|
4252
|
+
* @public
|
|
4253
|
+
* @category Error
|
|
4254
|
+
*/
|
|
4255
|
+
export declare class MongoTopologyClosedError extends MongoAPIError {
|
|
4256
|
+
constructor(message?: string);
|
|
4257
|
+
readonly name: string;
|
|
4258
|
+
}
|
|
4259
|
+
/**
|
|
4260
|
+
* An error generated when the user makes a mistake in the usage of transactions.
|
|
4261
|
+
* (e.g. attempting to commit a transaction with a readPreference other than primary)
|
|
4262
|
+
*
|
|
4263
|
+
* @public
|
|
4264
|
+
* @category Error
|
|
4265
|
+
*/
|
|
4266
|
+
export declare class MongoTransactionError extends MongoAPIError {
|
|
4267
|
+
constructor(message: string);
|
|
4268
|
+
readonly name: string;
|
|
4269
|
+
}
|
|
4042
4270
|
/**
|
|
4043
4271
|
* An error thrown when the server reports a writeConcernError
|
|
4044
4272
|
* @public
|
|
@@ -4047,7 +4275,8 @@ export declare class MongoSystemError extends MongoError {
|
|
|
4047
4275
|
export declare class MongoWriteConcernError extends MongoServerError {
|
|
4048
4276
|
/** The result document (provided if ok: 1) */
|
|
4049
4277
|
result?: Document;
|
|
4050
|
-
|
|
4278
|
+
errInfo?: Document;
|
|
4279
|
+
constructor(message: ErrorDescription, result?: Document);
|
|
4051
4280
|
readonly name: string;
|
|
4052
4281
|
}
|
|
4053
4282
|
/* Excluded from this release type: Monitor */
|
|
@@ -4074,6 +4303,11 @@ export declare type NotAcceptedFields<TSchema, FieldType> = {
|
|
|
4074
4303
|
};
|
|
4075
4304
|
/** @public */
|
|
4076
4305
|
export declare type NumericType = IntegerType | Decimal128 | Double;
|
|
4306
|
+
/**
|
|
4307
|
+
* @public
|
|
4308
|
+
* @deprecated Please use `ObjectId`
|
|
4309
|
+
*/
|
|
4310
|
+
export declare const ObjectID: typeof ObjectId;
|
|
4077
4311
|
export { ObjectId };
|
|
4078
4312
|
/** @public */
|
|
4079
4313
|
export declare type OneOrMore<T> = T | ReadonlyArray<T>;
|
|
@@ -4107,11 +4341,13 @@ export declare type OperationTime = Timestamp;
|
|
|
4107
4341
|
* `TSchema['_id'] extends ObjectId` which translated to "Is the _id property ObjectId?"
|
|
4108
4342
|
* we instead ask "Does ObjectId look like (have the same shape) as the _id?"
|
|
4109
4343
|
*/
|
|
4110
|
-
export declare type OptionalId<TSchema extends {
|
|
4344
|
+
export declare type OptionalId<TSchema> = TSchema extends {
|
|
4111
4345
|
_id?: any;
|
|
4112
|
-
}
|
|
4346
|
+
} ? ObjectId extends TSchema['_id'] ? EnhancedOmit<TSchema, '_id'> & {
|
|
4347
|
+
_id?: InferIdType<TSchema>;
|
|
4348
|
+
} : WithId<TSchema> : EnhancedOmit<TSchema, '_id'> & {
|
|
4113
4349
|
_id?: InferIdType<TSchema>;
|
|
4114
|
-
}
|
|
4350
|
+
};
|
|
4115
4351
|
/** @public */
|
|
4116
4352
|
export declare class OrderedBulkOperation extends BulkOperationBase {
|
|
4117
4353
|
constructor(collection: Collection, options: BulkWriteOptions);
|
|
@@ -4135,21 +4371,17 @@ export declare const ProfilingLevel: Readonly<{
|
|
|
4135
4371
|
export declare type ProfilingLevel = typeof ProfilingLevel[keyof typeof ProfilingLevel];
|
|
4136
4372
|
/** @public */
|
|
4137
4373
|
export declare type ProfilingLevelOptions = CommandOperationOptions;
|
|
4138
|
-
/**
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
export declare
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
$meta?: string;
|
|
4150
|
-
/** @deprecated Since MongoDB 3.2, Use FindCursor#max */
|
|
4151
|
-
$max?: any;
|
|
4152
|
-
}
|
|
4374
|
+
/**
|
|
4375
|
+
* @public
|
|
4376
|
+
* Projection is flexible to permit the wide array of aggregation operators
|
|
4377
|
+
* @deprecated since v4.1.0: Since projections support all aggregation operations we have no plans to narrow this type further
|
|
4378
|
+
*/
|
|
4379
|
+
export declare type Projection<TSchema extends Document = Document> = Document;
|
|
4380
|
+
/**
|
|
4381
|
+
* @public
|
|
4382
|
+
* @deprecated since v4.1.0: Since projections support all aggregation operations we have no plans to narrow this type further
|
|
4383
|
+
*/
|
|
4384
|
+
export declare type ProjectionOperators = Document;
|
|
4153
4385
|
/**
|
|
4154
4386
|
* Global promise store allowing user-provided promises
|
|
4155
4387
|
* @public
|
|
@@ -5214,19 +5446,26 @@ export declare class WriteConcern {
|
|
|
5214
5446
|
* @category Error
|
|
5215
5447
|
*/
|
|
5216
5448
|
export declare class WriteConcernError {
|
|
5217
|
-
|
|
5218
|
-
constructor(
|
|
5449
|
+
/* Excluded from this release type: [kServerError] */
|
|
5450
|
+
constructor(error: WriteConcernErrorData);
|
|
5219
5451
|
/*Write concern error code. */
|
|
5220
5452
|
readonly code: number | undefined;
|
|
5221
5453
|
/*Write concern error message. */
|
|
5222
|
-
readonly errmsg: string;
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5454
|
+
readonly errmsg: string | undefined;
|
|
5455
|
+
/*Write concern error info. */
|
|
5456
|
+
readonly errInfo: Document | undefined;
|
|
5457
|
+
/*@deprecated The `err` prop that contained a MongoServerError has been deprecated. */
|
|
5458
|
+
readonly err: WriteConcernErrorData;
|
|
5459
|
+
toJSON(): WriteConcernErrorData;
|
|
5227
5460
|
toString(): string;
|
|
5228
5461
|
}
|
|
5229
5462
|
/** @public */
|
|
5463
|
+
export declare interface WriteConcernErrorData {
|
|
5464
|
+
code: number;
|
|
5465
|
+
errmsg: string;
|
|
5466
|
+
errInfo?: Document;
|
|
5467
|
+
}
|
|
5468
|
+
/** @public */
|
|
5230
5469
|
export declare interface WriteConcernOptions {
|
|
5231
5470
|
/** Write Concern as an object */
|
|
5232
5471
|
writeConcern?: WriteConcern | WriteConcernSettings;
|
|
@@ -5260,6 +5499,8 @@ export declare class WriteError {
|
|
|
5260
5499
|
readonly index: number;
|
|
5261
5500
|
/*WriteError message. */
|
|
5262
5501
|
readonly errmsg: string | undefined;
|
|
5502
|
+
/*WriteError details. */
|
|
5503
|
+
readonly errInfo: Document | undefined;
|
|
5263
5504
|
/** Returns the underlying operation that caused the error */
|
|
5264
5505
|
getOperation(): Document;
|
|
5265
5506
|
toJSON(): {
|