mongodb 4.2.0 → 4.3.1
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 +2 -2
- package/lib/admin.js +3 -3
- package/lib/admin.js.map +1 -1
- package/lib/bson.js +16 -14
- package/lib/bson.js.map +1 -1
- package/lib/bulk/common.js +7 -7
- package/lib/bulk/common.js.map +1 -1
- package/lib/bulk/ordered.js +1 -1
- package/lib/bulk/ordered.js.map +1 -1
- package/lib/bulk/unordered.js +1 -1
- package/lib/bulk/unordered.js.map +1 -1
- package/lib/change_stream.js +6 -7
- package/lib/change_stream.js.map +1 -1
- package/lib/cmap/auth/auth_provider.js.map +1 -1
- package/lib/cmap/auth/gssapi.js +3 -3
- package/lib/cmap/auth/gssapi.js.map +1 -1
- package/lib/cmap/auth/mongo_credentials.js +24 -26
- 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 +6 -6
- 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/providers.js +21 -0
- package/lib/cmap/auth/providers.js.map +1 -0
- package/lib/cmap/auth/scram.js +4 -4
- 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 +3 -2
- package/lib/cmap/command_monitoring_events.js.map +1 -1
- package/lib/cmap/commands.js +20 -11
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connect.js +119 -31
- package/lib/cmap/connect.js.map +1 -1
- package/lib/cmap/connection.js +36 -35
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/connection_pool.js +19 -30
- 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 +4 -4
- package/lib/cmap/stream_description.js.map +1 -1
- package/lib/cmap/wire_protocol/compression.js +2 -1
- package/lib/cmap/wire_protocol/compression.js.map +1 -1
- package/lib/cmap/wire_protocol/shared.js +4 -3
- package/lib/cmap/wire_protocol/shared.js.map +1 -1
- package/lib/collection.js +45 -47
- package/lib/collection.js.map +1 -1
- package/lib/connection_string.js +48 -23
- package/lib/connection_string.js.map +1 -1
- package/lib/constants.js +113 -1
- package/lib/constants.js.map +1 -1
- package/lib/cursor/abstract_cursor.js +10 -7
- package/lib/cursor/abstract_cursor.js.map +1 -1
- package/lib/cursor/aggregation_cursor.js +1 -1
- package/lib/cursor/aggregation_cursor.js.map +1 -1
- package/lib/cursor/find_cursor.js +1 -1
- package/lib/cursor/find_cursor.js.map +1 -1
- package/lib/db.js +23 -13
- package/lib/db.js.map +1 -1
- package/lib/deps.js +0 -1
- package/lib/deps.js.map +1 -1
- package/lib/encrypter.js +12 -4
- package/lib/encrypter.js.map +1 -1
- package/lib/error.js +47 -24
- package/lib/error.js.map +1 -1
- package/lib/gridfs/download.js +1 -1
- package/lib/gridfs/download.js.map +1 -1
- package/lib/gridfs/index.js +3 -3
- package/lib/gridfs/index.js.map +1 -1
- package/lib/gridfs/upload.js +3 -2
- package/lib/gridfs/upload.js.map +1 -1
- package/lib/index.js +81 -81
- package/lib/index.js.map +1 -1
- package/lib/logger.js +1 -1
- package/lib/logger.js.map +1 -1
- package/lib/mongo_client.js +5 -5
- 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 +1 -1
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/bulk_write.js.map +1 -1
- package/lib/operations/collections.js +1 -1
- package/lib/operations/collections.js.map +1 -1
- package/lib/operations/command.js +5 -6
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/common_functions.js.map +1 -1
- package/lib/operations/connect.js +4 -13
- 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 +3 -2
- package/lib/operations/create_collection.js.map +1 -1
- package/lib/operations/delete.js +3 -3
- package/lib/operations/delete.js.map +1 -1
- package/lib/operations/distinct.js +3 -3
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/drop.js +1 -1
- 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 +2 -2
- package/lib/operations/eval.js.map +1 -1
- package/lib/operations/execute_operation.js +15 -9
- package/lib/operations/execute_operation.js.map +1 -1
- package/lib/operations/find.js +5 -5
- package/lib/operations/find.js.map +1 -1
- package/lib/operations/find_and_modify.js +2 -2
- package/lib/operations/find_and_modify.js.map +1 -1
- package/lib/operations/get_more.js +28 -0
- package/lib/operations/get_more.js.map +1 -0
- package/lib/operations/indexes.js +4 -4
- package/lib/operations/indexes.js.map +1 -1
- package/lib/operations/insert.js +3 -3
- package/lib/operations/insert.js.map +1 -1
- package/lib/operations/is_capped.js +1 -1
- package/lib/operations/is_capped.js.map +1 -1
- package/lib/operations/list_collections.js +3 -3
- 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 +4 -3
- package/lib/operations/map_reduce.js.map +1 -1
- package/lib/operations/operation.js +3 -2
- package/lib/operations/operation.js.map +1 -1
- package/lib/operations/options_operation.js +1 -1
- package/lib/operations/options_operation.js.map +1 -1
- package/lib/operations/profiling_level.js +1 -1
- 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 +3 -3
- package/lib/operations/rename.js.map +1 -1
- package/lib/operations/run_command.js +1 -1
- package/lib/operations/run_command.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 +1 -1
- package/lib/operations/stats.js.map +1 -1
- package/lib/operations/update.js +2 -2
- package/lib/operations/update.js.map +1 -1
- package/lib/operations/validate_collection.js +1 -1
- package/lib/operations/validate_collection.js.map +1 -1
- package/lib/read_preference.js +15 -5
- package/lib/read_preference.js.map +1 -1
- package/lib/sdam/events.js +4 -4
- package/lib/sdam/monitor.js +19 -18
- package/lib/sdam/monitor.js.map +1 -1
- package/lib/sdam/server.js +24 -31
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/server_description.js +38 -38
- package/lib/sdam/server_description.js.map +1 -1
- package/lib/sdam/server_selection.js +19 -3
- package/lib/sdam/server_selection.js.map +1 -1
- package/lib/sdam/srv_polling.js +2 -2
- package/lib/sdam/srv_polling.js.map +1 -1
- package/lib/sdam/topology.js +32 -62
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +3 -3
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +13 -28
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js +1 -1
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +46 -15
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +145 -61
- package/mongodb.ts34.d.ts +173 -60
- package/package.json +29 -28
- package/src/admin.ts +9 -9
- package/src/bson.ts +26 -17
- package/src/bulk/common.ts +22 -23
- package/src/bulk/ordered.ts +4 -4
- package/src/bulk/unordered.ts +5 -5
- package/src/change_stream.ts +31 -28
- package/src/cmap/auth/auth_provider.ts +3 -3
- package/src/cmap/auth/gssapi.ts +8 -8
- package/src/cmap/auth/mongo_credentials.ts +11 -15
- package/src/cmap/auth/mongocr.ts +3 -2
- package/src/cmap/auth/mongodb_aws.ts +10 -11
- package/src/cmap/auth/plain.ts +1 -1
- package/src/cmap/auth/providers.ts +21 -0
- package/src/cmap/auth/scram.ts +9 -9
- package/src/cmap/auth/x509.ts +3 -3
- package/src/cmap/command_monitoring_events.ts +4 -3
- package/src/cmap/commands.ts +30 -19
- package/src/cmap/connect.ts +161 -37
- package/src/cmap/connection.ts +83 -63
- package/src/cmap/connection_pool.ts +39 -39
- package/src/cmap/connection_pool_events.ts +1 -1
- package/src/cmap/message_stream.ts +9 -8
- package/src/cmap/stream_description.ts +5 -5
- package/src/cmap/wire_protocol/compression.ts +4 -3
- package/src/cmap/wire_protocol/shared.ts +10 -9
- package/src/collection.ts +114 -95
- package/src/connection_string.ts +66 -29
- package/src/constants.ts +122 -0
- package/src/cursor/abstract_cursor.ts +21 -22
- package/src/cursor/aggregation_cursor.ts +6 -6
- package/src/cursor/find_cursor.ts +2 -2
- package/src/db.ts +44 -33
- package/src/deps.ts +3 -1
- package/src/encrypter.ts +12 -3
- package/src/error.ts +52 -24
- package/src/gridfs/download.ts +10 -8
- package/src/gridfs/index.ts +11 -11
- package/src/gridfs/upload.ts +13 -10
- package/src/index.ts +204 -199
- package/src/logger.ts +2 -1
- package/src/mongo_client.ts +46 -32
- package/src/mongo_types.ts +119 -21
- package/src/operations/add_user.ts +7 -6
- package/src/operations/aggregate.ts +5 -5
- package/src/operations/bulk_write.ts +5 -5
- package/src/operations/collections.ts +2 -2
- package/src/operations/command.ts +15 -9
- package/src/operations/common_functions.ts +4 -4
- package/src/operations/connect.ts +4 -14
- package/src/operations/count.ts +4 -4
- package/src/operations/count_documents.ts +3 -3
- package/src/operations/create_collection.ts +7 -6
- package/src/operations/delete.ts +5 -5
- package/src/operations/distinct.ts +4 -4
- package/src/operations/drop.ts +4 -4
- package/src/operations/estimated_document_count.ts +5 -5
- package/src/operations/eval.ts +5 -5
- package/src/operations/execute_operation.ts +21 -13
- package/src/operations/find.ts +14 -14
- package/src/operations/find_and_modify.ts +7 -7
- package/src/operations/get_more.ts +49 -0
- package/src/operations/indexes.ts +16 -16
- package/src/operations/insert.ts +9 -9
- package/src/operations/is_capped.ts +3 -3
- package/src/operations/list_collections.ts +6 -6
- package/src/operations/list_databases.ts +4 -4
- package/src/operations/map_reduce.ts +10 -9
- package/src/operations/operation.ts +5 -4
- package/src/operations/options_operation.ts +3 -3
- package/src/operations/profiling_level.ts +4 -4
- package/src/operations/remove_user.ts +4 -4
- package/src/operations/rename.ts +6 -6
- package/src/operations/run_command.ts +3 -3
- package/src/operations/set_profiling_level.ts +6 -5
- package/src/operations/stats.ts +4 -4
- package/src/operations/update.ts +10 -10
- package/src/operations/validate_collection.ts +4 -4
- package/src/read_preference.ts +18 -7
- package/src/sdam/common.ts +2 -2
- package/src/sdam/events.ts +5 -5
- package/src/sdam/monitor.ts +29 -32
- package/src/sdam/server.ts +64 -62
- package/src/sdam/server_description.ts +41 -48
- package/src/sdam/server_selection.ts +21 -3
- package/src/sdam/srv_polling.ts +3 -2
- package/src/sdam/topology.ts +71 -89
- package/src/sdam/topology_description.ts +5 -5
- package/src/sessions.ts +31 -48
- package/src/transactions.ts +4 -4
- package/src/utils.ts +69 -33
- package/lib/cmap/auth/defaultAuthProviders.js +0 -30
- package/lib/cmap/auth/defaultAuthProviders.js.map +0 -1
- package/src/cmap/auth/defaultAuthProviders.ts +0 -32
package/mongodb.ts34.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { Map as Map_2 } from 'bson';
|
|
|
21
21
|
import { MaxKey } from 'bson';
|
|
22
22
|
import { MinKey } from 'bson';
|
|
23
23
|
import { ObjectId } from 'bson';
|
|
24
|
+
import { ObjectIdLike } from 'bson';
|
|
24
25
|
import { Readable } from 'stream';
|
|
25
26
|
import { serialize as serialize_2 } from 'bson';
|
|
26
27
|
import { SerializeOptions } from 'bson';
|
|
@@ -617,6 +618,7 @@ export declare interface AutoEncryptionOptions {
|
|
|
617
618
|
/** Command line arguments to use when auto-spawning a mongocryptd */
|
|
618
619
|
mongocryptdSpawnArgs?: string[];
|
|
619
620
|
};
|
|
621
|
+
proxyOptions?: ProxyOptions;
|
|
620
622
|
}
|
|
621
623
|
/**
|
|
622
624
|
* Keeps the state of a unordered batch so we can rewrite the results
|
|
@@ -650,9 +652,11 @@ export { BSONRegExp };
|
|
|
650
652
|
* BSON Serialization options.
|
|
651
653
|
* @public
|
|
652
654
|
*/
|
|
653
|
-
export declare interface BSONSerializeOptions extends Pick<SerializeOptions, Exclude<keyof SerializeOptions, 'index'>>, Pick<DeserializeOptions, Exclude<keyof DeserializeOptions, 'evalFunctions' | 'cacheFunctions' | 'cacheFunctionsCrc32' | 'allowObjectSmallerThanBufferSize' | 'index'>> {
|
|
655
|
+
export declare interface BSONSerializeOptions extends Pick<SerializeOptions, Exclude<keyof SerializeOptions, 'index'>>, Pick<DeserializeOptions, Exclude<keyof DeserializeOptions, 'evalFunctions' | 'cacheFunctions' | 'cacheFunctionsCrc32' | 'allowObjectSmallerThanBufferSize' | 'index' | 'validation'>> {
|
|
654
656
|
/** Return BSON filled buffers from operations */
|
|
655
657
|
raw?: boolean;
|
|
658
|
+
/** Enable utf8 validation when deserializing BSON documents. Defaults to true. */
|
|
659
|
+
enableUtf8Validation?: boolean;
|
|
656
660
|
}
|
|
657
661
|
export { BSONSymbol };
|
|
658
662
|
/** @public */
|
|
@@ -904,7 +908,8 @@ export declare class ChangeStream<TSchema extends Document = Document> extends T
|
|
|
904
908
|
The cached resume token that is used to resume after the most recently returned change. */
|
|
905
909
|
readonly resumeToken: ResumeToken;
|
|
906
910
|
/** Check if there is any document still available in the Change Stream */
|
|
907
|
-
hasNext(
|
|
911
|
+
hasNext(): Promise<boolean>;
|
|
912
|
+
hasNext(callback: Callback<boolean>): void;
|
|
908
913
|
/** Get the next available document from the Change Stream. */
|
|
909
914
|
next(): Promise<ChangeStreamDocument<TSchema>>;
|
|
910
915
|
next(callback: Callback<ChangeStreamDocument<TSchema>>): void;
|
|
@@ -995,9 +1000,9 @@ export declare interface ChangeStreamOptions extends AggregateOptions {
|
|
|
995
1000
|
fullDocument?: string;
|
|
996
1001
|
/** The maximum amount of time for the server to wait on new documents to satisfy a change stream query. */
|
|
997
1002
|
maxAwaitTimeMS?: number;
|
|
998
|
-
/** Allows you to start a changeStream after a specified event. See {@link https://docs.mongodb.com/
|
|
1003
|
+
/** Allows you to start a changeStream after a specified event. See {@link https://docs.mongodb.com/manual/changeStreams/#resumeafter-for-change-streams|ChangeStream documentation}. */
|
|
999
1004
|
resumeAfter?: ResumeToken;
|
|
1000
|
-
/** Similar to resumeAfter, but will allow you to start after an invalidated event. See {@link https://docs.mongodb.com/
|
|
1005
|
+
/** Similar to resumeAfter, but will allow you to start after an invalidated event. See {@link https://docs.mongodb.com/manual/changeStreams/#startafter-for-change-streams|ChangeStream documentation}. */
|
|
1001
1006
|
startAfter?: ResumeToken;
|
|
1002
1007
|
/** Will start the changeStream after the specified operationTime. */
|
|
1003
1008
|
startAtOperationTime?: OperationTime;
|
|
@@ -1243,10 +1248,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1243
1248
|
* @param options - Optional settings for the command
|
|
1244
1249
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1245
1250
|
*/
|
|
1246
|
-
insertOne(doc:
|
|
1247
|
-
insertOne(doc:
|
|
1248
|
-
insertOne(doc:
|
|
1249
|
-
insertOne(doc:
|
|
1251
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>): Promise<InsertOneResult<TSchema>>;
|
|
1252
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>, callback: Callback<InsertOneResult<TSchema>>): void;
|
|
1253
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>, options: InsertOneOptions): Promise<InsertOneResult<TSchema>>;
|
|
1254
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>, options: InsertOneOptions, callback: Callback<InsertOneResult<TSchema>>): void;
|
|
1250
1255
|
/**
|
|
1251
1256
|
* Inserts an array of documents into MongoDB. If documents passed in do not contain the **_id** field,
|
|
1252
1257
|
* one will be added to each of the documents missing it by the driver, mutating the document. This behavior
|
|
@@ -1256,10 +1261,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1256
1261
|
* @param options - Optional settings for the command
|
|
1257
1262
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1258
1263
|
*/
|
|
1259
|
-
insertMany(docs:
|
|
1260
|
-
insertMany(docs:
|
|
1261
|
-
insertMany(docs:
|
|
1262
|
-
insertMany(docs:
|
|
1264
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[]): Promise<InsertManyResult<TSchema>>;
|
|
1265
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[], callback: Callback<InsertManyResult<TSchema>>): void;
|
|
1266
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[], options: BulkWriteOptions): Promise<InsertManyResult<TSchema>>;
|
|
1267
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[], options: BulkWriteOptions, callback: Callback<InsertManyResult<TSchema>>): void;
|
|
1263
1268
|
/**
|
|
1264
1269
|
* Perform a bulkWrite operation without a fluent API
|
|
1265
1270
|
*
|
|
@@ -1315,10 +1320,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1315
1320
|
* @param options - Optional settings for the command
|
|
1316
1321
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1317
1322
|
*/
|
|
1318
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema): Promise<UpdateResult | Document>;
|
|
1319
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema
|
|
1320
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema
|
|
1321
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema
|
|
1323
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>): Promise<UpdateResult | Document>;
|
|
1324
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, callback: Callback<UpdateResult | Document>): void;
|
|
1325
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: ReplaceOptions): Promise<UpdateResult | Document>;
|
|
1326
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: ReplaceOptions, callback: Callback<UpdateResult | Document>): void;
|
|
1322
1327
|
/**
|
|
1323
1328
|
* Update multiple documents in a collection
|
|
1324
1329
|
*
|
|
@@ -1401,8 +1406,8 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1401
1406
|
* @param filter - The filter predicate. If unspecified, then all documents in the collection will match the predicate
|
|
1402
1407
|
*/
|
|
1403
1408
|
find(): FindCursor<WithId<TSchema>>;
|
|
1404
|
-
find(filter: Filter<
|
|
1405
|
-
find<T>(filter: Filter<
|
|
1409
|
+
find(filter: Filter<TSchema>, options?: FindOptions): FindCursor<WithId<TSchema>>;
|
|
1410
|
+
find<T>(filter: Filter<TSchema>, options?: FindOptions): FindCursor<T>;
|
|
1406
1411
|
/**
|
|
1407
1412
|
* Returns the options of the collection.
|
|
1408
1413
|
*
|
|
@@ -1642,10 +1647,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1642
1647
|
* @param options - Optional settings for the command
|
|
1643
1648
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1644
1649
|
*/
|
|
1645
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1646
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1647
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1648
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1650
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>): Promise<ModifyResult<TSchema>>;
|
|
1651
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, callback: Callback<ModifyResult<TSchema>>): void;
|
|
1652
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: FindOneAndReplaceOptions): Promise<ModifyResult<TSchema>>;
|
|
1653
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: FindOneAndReplaceOptions, callback: Callback<ModifyResult<TSchema>>): void;
|
|
1649
1654
|
/**
|
|
1650
1655
|
* Find a document and update it in one atomic operation. Requires a write lock for the duration of the operation.
|
|
1651
1656
|
*
|
|
@@ -1703,7 +1708,7 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1703
1708
|
* @param options - Optional settings for the command
|
|
1704
1709
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1705
1710
|
*/
|
|
1706
|
-
insert(docs:
|
|
1711
|
+
insert(docs: OptionalUnlessRequiredId<TSchema>[], options: BulkWriteOptions, callback: Callback<InsertManyResult<TSchema>>): Promise<InsertManyResult<TSchema>> | void;
|
|
1707
1712
|
/**
|
|
1708
1713
|
* Updates documents.
|
|
1709
1714
|
*
|
|
@@ -1756,6 +1761,9 @@ export declare interface CollectionInfo extends Document {
|
|
|
1756
1761
|
}
|
|
1757
1762
|
/** @public */
|
|
1758
1763
|
export declare interface CollectionOptions extends BSONSerializeOptions, WriteConcernOptions, LoggerOptions {
|
|
1764
|
+
/**
|
|
1765
|
+
* @deprecated Use readPreference instead
|
|
1766
|
+
*/
|
|
1759
1767
|
slaveOk?: boolean;
|
|
1760
1768
|
/** Specify a read concern for the collection. (only MongoDB 3.2 or higher supported) */
|
|
1761
1769
|
readConcern?: ReadConcernLike;
|
|
@@ -1970,7 +1978,7 @@ export declare type ConnectionEvents = {
|
|
|
1970
1978
|
unpinned(pinType: string): void;
|
|
1971
1979
|
};
|
|
1972
1980
|
/** @public */
|
|
1973
|
-
export declare interface ConnectionOptions extends SupportedNodeConnectionOptions, StreamDescriptionOptions {
|
|
1981
|
+
export declare interface ConnectionOptions extends SupportedNodeConnectionOptions, StreamDescriptionOptions, ProxyOptions {
|
|
1974
1982
|
id: number | '<monitor>';
|
|
1975
1983
|
generation: number;
|
|
1976
1984
|
hostAddress: HostAddress;
|
|
@@ -2211,7 +2219,15 @@ export declare class Db {
|
|
|
2211
2219
|
constructor(client: MongoClient, databaseName: string, options?: DbOptions);
|
|
2212
2220
|
readonly databaseName: string;
|
|
2213
2221
|
readonly options: DbOptions | undefined;
|
|
2222
|
+
/*
|
|
2223
|
+
* slaveOk specified
|
|
2224
|
+
* @deprecated Use secondaryOk instead
|
|
2225
|
+
*/
|
|
2214
2226
|
readonly slaveOk: boolean;
|
|
2227
|
+
/*
|
|
2228
|
+
* Check if a secondary can be used (because the read preference is *not* set to primary)
|
|
2229
|
+
*/
|
|
2230
|
+
readonly secondaryOk: boolean;
|
|
2215
2231
|
readonly readConcern: ReadConcern | undefined;
|
|
2216
2232
|
/*
|
|
2217
2233
|
* The current readPreference of the Db. If not explicitly defined for
|
|
@@ -2581,15 +2597,15 @@ export declare type ExplainVerbosity = string;
|
|
|
2581
2597
|
*/
|
|
2582
2598
|
export declare type ExplainVerbosityLike = ExplainVerbosity | boolean;
|
|
2583
2599
|
/** A MongoDB filter can be some portion of the schema or a set of operators @public */
|
|
2584
|
-
export declare type Filter<TSchema> = {
|
|
2585
|
-
[
|
|
2586
|
-
} & RootFilterOperators<TSchema
|
|
2600
|
+
export declare type Filter<TSchema> = Partial<TSchema> | ({
|
|
2601
|
+
[Property in Join<NestedPaths<WithId<TSchema>>, '.'>]?: Condition<PropertyType<WithId<TSchema>, Property>>;
|
|
2602
|
+
} & RootFilterOperators<WithId<TSchema>>);
|
|
2587
2603
|
/** @public */
|
|
2588
2604
|
export declare type FilterOperations<T> = T extends Record<string, any> ? {
|
|
2589
2605
|
[key in keyof T]?: FilterOperators<T[key]>;
|
|
2590
2606
|
} : FilterOperators<T>;
|
|
2591
2607
|
/** @public */
|
|
2592
|
-
export declare interface FilterOperators<TValue> extends
|
|
2608
|
+
export declare interface FilterOperators<TValue> extends NonObjectIdLikeDocument {
|
|
2593
2609
|
$eq?: TValue;
|
|
2594
2610
|
$gt?: TValue;
|
|
2595
2611
|
$gte?: TValue;
|
|
@@ -2875,7 +2891,7 @@ export declare interface FindOptions<TSchema extends Document = Document> extend
|
|
|
2875
2891
|
timeout?: boolean;
|
|
2876
2892
|
/** Specify if the cursor is tailable. */
|
|
2877
2893
|
tailable?: boolean;
|
|
2878
|
-
/** Specify if the cursor is a
|
|
2894
|
+
/** Specify if the cursor is a tailable-await cursor. Requires `tailable` to be true */
|
|
2879
2895
|
awaitData?: boolean;
|
|
2880
2896
|
/** Set the batchSize for the getMoreCommand when iterating over the query results. */
|
|
2881
2897
|
batchSize?: number;
|
|
@@ -3132,12 +3148,12 @@ export declare class GridFSBucketWriteStream extends Writable implements NodeJS.
|
|
|
3132
3148
|
* @param encoding - Optional encoding for the buffer
|
|
3133
3149
|
* @param callback - Function to call when all files and chunks have been persisted to MongoDB
|
|
3134
3150
|
*/
|
|
3135
|
-
end():
|
|
3136
|
-
end(chunk: Buffer):
|
|
3137
|
-
end(callback: Callback<GridFSFile | void>):
|
|
3138
|
-
end(chunk: Buffer, callback: Callback<GridFSFile | void>):
|
|
3139
|
-
end(chunk: Buffer, encoding: BufferEncoding):
|
|
3140
|
-
end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>):
|
|
3151
|
+
end(): this;
|
|
3152
|
+
end(chunk: Buffer): this;
|
|
3153
|
+
end(callback: Callback<GridFSFile | void>): this;
|
|
3154
|
+
end(chunk: Buffer, callback: Callback<GridFSFile | void>): this;
|
|
3155
|
+
end(chunk: Buffer, encoding: BufferEncoding): this;
|
|
3156
|
+
end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>): this;
|
|
3141
3157
|
}
|
|
3142
3158
|
/** @public */
|
|
3143
3159
|
export declare interface GridFSBucketWriteStreamOptions extends WriteConcernOptions {
|
|
@@ -3190,6 +3206,7 @@ export declare class HostAddress {
|
|
|
3190
3206
|
*/
|
|
3191
3207
|
toString(ipv6Brackets?: boolean): string;
|
|
3192
3208
|
static fromString(s: string): HostAddress;
|
|
3209
|
+
static fromHostPort(host: string, port: number): HostAddress;
|
|
3193
3210
|
static fromSrvRecord({ name, port }: SrvRecord): HostAddress;
|
|
3194
3211
|
}
|
|
3195
3212
|
/** @public */
|
|
@@ -3221,7 +3238,9 @@ export declare type IndexSpecification = OneOrMore<string | [
|
|
|
3221
3238
|
/** Given an object shaped type, return the type of the _id field or default to ObjectId @public */
|
|
3222
3239
|
export declare type InferIdType<TSchema> = TSchema extends {
|
|
3223
3240
|
_id: infer IdType;
|
|
3224
|
-
} ?
|
|
3241
|
+
} ? Record<any, never> extends IdType ? never : IdType : TSchema extends {
|
|
3242
|
+
_id?: infer IdType;
|
|
3243
|
+
} ? unknown extends IdType ? ObjectId : IdType : ObjectId;
|
|
3225
3244
|
/** @public */
|
|
3226
3245
|
export declare interface InsertManyResult<TSchema = Document> {
|
|
3227
3246
|
/** Indicates whether this write result was acknowledged. If not, then all other members of this result will be undefined */
|
|
@@ -3259,6 +3278,17 @@ export declare type IntegerType = number | Int32 | Long;
|
|
|
3259
3278
|
/* Excluded from this release type: InterruptibleAsyncInterval */
|
|
3260
3279
|
/** @public */
|
|
3261
3280
|
export declare type IsAny<Type, ResultIfAny, ResultIfNotAny> = true extends false & Type ? ResultIfAny : ResultIfNotAny;
|
|
3281
|
+
/**
|
|
3282
|
+
* Helper types for dot-notation filter attributes
|
|
3283
|
+
*/
|
|
3284
|
+
/** @public */
|
|
3285
|
+
export declare type Join<T extends unknown[], D extends string> = T extends [
|
|
3286
|
+
] ? '' : T extends [
|
|
3287
|
+
string | number
|
|
3288
|
+
] ? `${T[0]}` : T extends [
|
|
3289
|
+
string | number,
|
|
3290
|
+
...infer R
|
|
3291
|
+
] ? `${T[0]}${D}${Join<R, D>}` : string;
|
|
3262
3292
|
/* Excluded from this release type: kBeforeHandshake */
|
|
3263
3293
|
/* Excluded from this release type: kBuffer */
|
|
3264
3294
|
/* Excluded from this release type: kBuffers */
|
|
@@ -3290,11 +3320,11 @@ export declare type KeysOfOtherType<TSchema, Type> = {
|
|
|
3290
3320
|
/* Excluded from this release type: kFullResult */
|
|
3291
3321
|
/* Excluded from this release type: kGeneration */
|
|
3292
3322
|
/* Excluded from this release type: kGeneration_2 */
|
|
3323
|
+
/* Excluded from this release type: kHello */
|
|
3293
3324
|
/* Excluded from this release type: kId */
|
|
3294
3325
|
/* Excluded from this release type: KillCursor */
|
|
3295
3326
|
/* Excluded from this release type: kInitialized */
|
|
3296
3327
|
/* Excluded from this release type: kInternalClient */
|
|
3297
|
-
/* Excluded from this release type: kIsMaster */
|
|
3298
3328
|
/* Excluded from this release type: kKilled */
|
|
3299
3329
|
/* Excluded from this release type: kLastUseTime */
|
|
3300
3330
|
/* Excluded from this release type: kLength */
|
|
@@ -3543,7 +3573,7 @@ export { MaxKey };
|
|
|
3543
3573
|
export { MinKey };
|
|
3544
3574
|
/** @public */
|
|
3545
3575
|
export declare interface ModifyResult<TSchema = Document> {
|
|
3546
|
-
value: TSchema | null;
|
|
3576
|
+
value: WithId<TSchema> | null;
|
|
3547
3577
|
lastErrorObject?: Document;
|
|
3548
3578
|
ok: 0 | 1;
|
|
3549
3579
|
}
|
|
@@ -3559,7 +3589,21 @@ export declare const MONGO_CLIENT_EVENTS: readonly [
|
|
|
3559
3589
|
"connectionCheckedOut",
|
|
3560
3590
|
"connectionCheckedIn",
|
|
3561
3591
|
"connectionPoolCleared",
|
|
3562
|
-
|
|
3592
|
+
"commandStarted",
|
|
3593
|
+
"commandSucceeded",
|
|
3594
|
+
"commandFailed",
|
|
3595
|
+
"serverOpening",
|
|
3596
|
+
"serverClosed",
|
|
3597
|
+
"serverDescriptionChanged",
|
|
3598
|
+
"topologyOpening",
|
|
3599
|
+
"topologyClosed",
|
|
3600
|
+
"topologyDescriptionChanged",
|
|
3601
|
+
"error",
|
|
3602
|
+
"timeout",
|
|
3603
|
+
"close",
|
|
3604
|
+
"serverHeartbeatStarted",
|
|
3605
|
+
"serverHeartbeatSucceeded",
|
|
3606
|
+
"serverHeartbeatFailed"
|
|
3563
3607
|
];
|
|
3564
3608
|
/**
|
|
3565
3609
|
* An error generated when the driver API is used incorrectly
|
|
@@ -3690,8 +3734,8 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> {
|
|
|
3690
3734
|
*
|
|
3691
3735
|
* @see docs.mongodb.org/manual/reference/connection-string/
|
|
3692
3736
|
*/
|
|
3693
|
-
connect(): Promise<
|
|
3694
|
-
connect(callback: Callback<
|
|
3737
|
+
connect(): Promise<this>;
|
|
3738
|
+
connect(callback: Callback<this>): void;
|
|
3695
3739
|
/**
|
|
3696
3740
|
* Close the db and its underlying connections
|
|
3697
3741
|
*
|
|
@@ -3897,6 +3941,14 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
3897
3941
|
autoEncryption?: AutoEncryptionOptions;
|
|
3898
3942
|
/** Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver */
|
|
3899
3943
|
driverInfo?: DriverInfo;
|
|
3944
|
+
/** Configures a Socks5 proxy host used for creating TCP connections. */
|
|
3945
|
+
proxyHost?: string;
|
|
3946
|
+
/** Configures a Socks5 proxy port used for creating TCP connections. */
|
|
3947
|
+
proxyPort?: number;
|
|
3948
|
+
/** Configures a Socks5 proxy username when the proxy in proxyHost requires username/password authentication. */
|
|
3949
|
+
proxyUsername?: string;
|
|
3950
|
+
/** Configures a Socks5 proxy password when the proxy in proxyHost requires username/password authentication. */
|
|
3951
|
+
proxyPassword?: string;
|
|
3900
3952
|
}
|
|
3901
3953
|
/* Excluded from this release type: MongoClientPrivate */
|
|
3902
3954
|
/**
|
|
@@ -3933,9 +3985,9 @@ export declare class MongoCredentials {
|
|
|
3933
3985
|
* If the authentication mechanism is set to "default", resolves the authMechanism
|
|
3934
3986
|
* based on the server version and server supported sasl mechanisms.
|
|
3935
3987
|
*
|
|
3936
|
-
* @param
|
|
3988
|
+
* @param hello - A hello response from the server
|
|
3937
3989
|
*/
|
|
3938
|
-
resolveAuthMechanism(
|
|
3990
|
+
resolveAuthMechanism(hello?: Document): MongoCredentials;
|
|
3939
3991
|
validate(): void;
|
|
3940
3992
|
static merge(creds: MongoCredentials | undefined, options: Partial<MongoCredentialsOptions>): MongoCredentials;
|
|
3941
3993
|
}
|
|
@@ -4166,6 +4218,10 @@ export declare interface MongoOptions extends Required<Pick<MongoClientOptions,
|
|
|
4166
4218
|
dbName: string;
|
|
4167
4219
|
metadata: ClientMetadata;
|
|
4168
4220
|
autoEncrypter?: AutoEncrypter;
|
|
4221
|
+
proxyHost?: string;
|
|
4222
|
+
proxyPort?: number;
|
|
4223
|
+
proxyUsername?: string;
|
|
4224
|
+
proxyPassword?: string;
|
|
4169
4225
|
/* Excluded from this release type: connectionType */
|
|
4170
4226
|
/* Excluded from this release type: encrypter */
|
|
4171
4227
|
/* Excluded from this release type: userSpecifiedAuthSource */
|
|
@@ -4314,6 +4370,44 @@ export declare interface MonitorOptions extends Pick<ConnectionOptions, Exclude<
|
|
|
4314
4370
|
}
|
|
4315
4371
|
/* Excluded from this release type: MonitorPrivate */
|
|
4316
4372
|
/* Excluded from this release type: Msg */
|
|
4373
|
+
/**
|
|
4374
|
+
* @public
|
|
4375
|
+
* returns tuple of strings (keys to be joined on '.') that represent every path into a schema
|
|
4376
|
+
* https://docs.mongodb.com/manual/tutorial/query-embedded-documents/
|
|
4377
|
+
*/
|
|
4378
|
+
export declare type NestedPaths<Type> = Type extends string | number | boolean | Date | RegExp | Buffer | Uint8Array | ((...args: any[]) => any) | {
|
|
4379
|
+
_bsontype: string;
|
|
4380
|
+
} ? [
|
|
4381
|
+
] : Type extends ReadonlyArray<infer ArrayType> ? [
|
|
4382
|
+
number,
|
|
4383
|
+
...NestedPaths<ArrayType>
|
|
4384
|
+
] : Type extends Map<string, any> ? [
|
|
4385
|
+
string
|
|
4386
|
+
] : Type extends object ? {
|
|
4387
|
+
[Key in Extract<keyof Type, string>]: Type[Key] extends Type ? [
|
|
4388
|
+
Key
|
|
4389
|
+
] : Type extends Type[Key] ? [
|
|
4390
|
+
Key
|
|
4391
|
+
] : Type[Key] extends ReadonlyArray<infer ArrayType> ? Type extends ArrayType ? [
|
|
4392
|
+
Key
|
|
4393
|
+
] : ArrayType extends Type ? [
|
|
4394
|
+
Key
|
|
4395
|
+
] : [
|
|
4396
|
+
Key,
|
|
4397
|
+
...NestedPaths<Type[Key]>
|
|
4398
|
+
] : [
|
|
4399
|
+
Key,
|
|
4400
|
+
...NestedPaths<Type[Key]>
|
|
4401
|
+
];
|
|
4402
|
+
}[Extract<keyof Type, string>] : [
|
|
4403
|
+
];
|
|
4404
|
+
/**
|
|
4405
|
+
* @public
|
|
4406
|
+
* A type that extends Document but forbids anything that "looks like" an object id.
|
|
4407
|
+
*/
|
|
4408
|
+
export declare type NonObjectIdLikeDocument = {
|
|
4409
|
+
[key in keyof ObjectIdLike]?: never;
|
|
4410
|
+
} & Document;
|
|
4317
4411
|
/** It avoids using fields with not acceptable types @public */
|
|
4318
4412
|
export declare type NotAcceptedFields<TSchema, FieldType> = {
|
|
4319
4413
|
readonly [key in KeysOfOtherType<TSchema, FieldType>]?: never;
|
|
@@ -4354,19 +4448,24 @@ export declare type OperationTime = Timestamp;
|
|
|
4354
4448
|
/**
|
|
4355
4449
|
* Add an optional _id field to an object shaped type
|
|
4356
4450
|
* @public
|
|
4451
|
+
*/
|
|
4452
|
+
export declare type OptionalId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
|
|
4453
|
+
_id?: InferIdType<TSchema>;
|
|
4454
|
+
};
|
|
4455
|
+
/**
|
|
4456
|
+
* Adds an optional _id field to an object shaped type, unless the _id field is requried on that type.
|
|
4457
|
+
* In the case _id is required, this method continues to require_id.
|
|
4458
|
+
*
|
|
4459
|
+
* @public
|
|
4357
4460
|
*
|
|
4358
4461
|
* @privateRemarks
|
|
4359
4462
|
* `ObjectId extends TSchema['_id']` is a confusing ordering at first glance. Rather than ask
|
|
4360
4463
|
* `TSchema['_id'] extends ObjectId` which translated to "Is the _id property ObjectId?"
|
|
4361
4464
|
* we instead ask "Does ObjectId look like (have the same shape) as the _id?"
|
|
4362
4465
|
*/
|
|
4363
|
-
export declare type
|
|
4364
|
-
_id
|
|
4365
|
-
} ?
|
|
4366
|
-
_id?: InferIdType<TSchema>;
|
|
4367
|
-
} : WithId<TSchema> : EnhancedOmit<TSchema, '_id'> & {
|
|
4368
|
-
_id?: InferIdType<TSchema>;
|
|
4369
|
-
};
|
|
4466
|
+
export declare type OptionalUnlessRequiredId<TSchema> = TSchema extends {
|
|
4467
|
+
_id: any;
|
|
4468
|
+
} ? TSchema : OptionalId<TSchema>;
|
|
4370
4469
|
/** @public */
|
|
4371
4470
|
export declare class OrderedBulkOperation extends BulkOperationBase {
|
|
4372
4471
|
constructor(collection: Collection, options: BulkWriteOptions);
|
|
@@ -4415,6 +4514,15 @@ declare class Promise_2 {
|
|
|
4415
4514
|
}
|
|
4416
4515
|
export { Promise_2 as Promise };
|
|
4417
4516
|
/** @public */
|
|
4517
|
+
export declare type PropertyType<Type, Property extends string> = string extends Property ? unknown : Property extends keyof Type ? Type[Property] : Property extends `${number}` ? Type extends ReadonlyArray<infer ArrayType> ? ArrayType : unknown : Property extends `${infer Key}.${infer Rest}` ? Key extends `${number}` ? Type extends ReadonlyArray<infer ArrayType> ? PropertyType<ArrayType, Rest> : unknown : Key extends keyof Type ? Type[Key] extends Map<string, infer MapType> ? MapType : PropertyType<Type[Key], Rest> : unknown : unknown;
|
|
4518
|
+
/** @public */
|
|
4519
|
+
export declare interface ProxyOptions {
|
|
4520
|
+
proxyHost?: string;
|
|
4521
|
+
proxyPort?: number;
|
|
4522
|
+
proxyUsername?: string;
|
|
4523
|
+
proxyPassword?: string;
|
|
4524
|
+
}
|
|
4525
|
+
/** @public */
|
|
4418
4526
|
export declare type PullAllOperator<TSchema> = ({
|
|
4419
4527
|
readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: TSchema[key];
|
|
4420
4528
|
} & NotAcceptedFields<TSchema, ReadonlyArray<any>>) & {
|
|
@@ -4528,11 +4636,16 @@ export declare class ReadPreference {
|
|
|
4528
4636
|
*/
|
|
4529
4637
|
isValid(mode?: string): boolean;
|
|
4530
4638
|
/**
|
|
4531
|
-
* Indicates that this readPreference needs the "
|
|
4532
|
-
*
|
|
4639
|
+
* Indicates that this readPreference needs the "secondaryOk" bit when sent over the wire
|
|
4640
|
+
* @deprecated Use secondaryOk instead
|
|
4533
4641
|
* @see https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-query
|
|
4534
4642
|
*/
|
|
4535
4643
|
slaveOk(): boolean;
|
|
4644
|
+
/**
|
|
4645
|
+
* Indicates that this readPreference needs the "SecondaryOk" bit when sent over the wire
|
|
4646
|
+
* @see https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-query
|
|
4647
|
+
*/
|
|
4648
|
+
secondaryOk(): boolean;
|
|
4536
4649
|
/**
|
|
4537
4650
|
* Check if the two ReadPreferences are equivalent
|
|
4538
4651
|
*
|
|
@@ -4594,7 +4707,7 @@ export declare interface ReplaceOneModel<TSchema extends Document = Document> {
|
|
|
4594
4707
|
/** The filter to limit the replaced document. */
|
|
4595
4708
|
filter: Filter<TSchema>;
|
|
4596
4709
|
/** The document with which to replace the matched document. */
|
|
4597
|
-
replacement: TSchema
|
|
4710
|
+
replacement: WithoutId<TSchema>;
|
|
4598
4711
|
/** Specifies a collation. */
|
|
4599
4712
|
collation?: CollationOptions;
|
|
4600
4713
|
/** The index to use. If specified, then the query system will only consider plans using the hinted index. */
|
|
@@ -4622,7 +4735,7 @@ export declare interface ResumeOptions {
|
|
|
4622
4735
|
readPreference?: ReadPreference;
|
|
4623
4736
|
}
|
|
4624
4737
|
/**
|
|
4625
|
-
* Represents the logical starting point for a new or resuming {@link https://docs.mongodb.com/
|
|
4738
|
+
* Represents the logical starting point for a new or resuming {@link https://docs.mongodb.com/manual/changeStreams/#std-label-change-stream-resume| Change Stream} on the server.
|
|
4626
4739
|
* @public
|
|
4627
4740
|
*/
|
|
4628
4741
|
export declare type ResumeToken = unknown;
|
|
@@ -4692,7 +4805,7 @@ export declare type ServerApiVersion = typeof ServerApiVersion[keyof typeof Serv
|
|
|
4692
4805
|
export declare class ServerCapabilities {
|
|
4693
4806
|
maxWireVersion: number;
|
|
4694
4807
|
minWireVersion: number;
|
|
4695
|
-
constructor(
|
|
4808
|
+
constructor(hello: Document);
|
|
4696
4809
|
readonly hasAggregationCursor: boolean;
|
|
4697
4810
|
readonly hasWriteCommands: boolean;
|
|
4698
4811
|
readonly hasTextSearch: boolean;
|
|
@@ -4715,7 +4828,7 @@ export declare class ServerClosedEvent {
|
|
|
4715
4828
|
address: string;
|
|
4716
4829
|
}
|
|
4717
4830
|
/**
|
|
4718
|
-
* The client's view of a single server, based on the most recent
|
|
4831
|
+
* The client's view of a single server, based on the most recent hello outcome.
|
|
4719
4832
|
*
|
|
4720
4833
|
* Internal type, not meant to be directly instantiated
|
|
4721
4834
|
* @public
|
|
@@ -4786,7 +4899,7 @@ export declare type ServerEvents = {
|
|
|
4786
4899
|
ended(): void;
|
|
4787
4900
|
} & ConnectionPoolEvents & EventEmitterWithState;
|
|
4788
4901
|
/**
|
|
4789
|
-
* Emitted when the server monitor’s
|
|
4902
|
+
* Emitted when the server monitor’s hello fails, either with an “ok: 0” or a socket exception.
|
|
4790
4903
|
* @public
|
|
4791
4904
|
* @category Event
|
|
4792
4905
|
*/
|
|
@@ -4799,8 +4912,8 @@ export declare class ServerHeartbeatFailedEvent {
|
|
|
4799
4912
|
failure: Error;
|
|
4800
4913
|
}
|
|
4801
4914
|
/**
|
|
4802
|
-
* Emitted when the server monitor’s
|
|
4803
|
-
* the
|
|
4915
|
+
* Emitted when the server monitor’s hello command is started - immediately before
|
|
4916
|
+
* the hello command is serialized into raw BSON and written to the socket.
|
|
4804
4917
|
*
|
|
4805
4918
|
* @public
|
|
4806
4919
|
* @category Event
|
|
@@ -4810,7 +4923,7 @@ export declare class ServerHeartbeatStartedEvent {
|
|
|
4810
4923
|
connectionId: string;
|
|
4811
4924
|
}
|
|
4812
4925
|
/**
|
|
4813
|
-
* Emitted when the server monitor’s
|
|
4926
|
+
* Emitted when the server monitor’s hello succeeds.
|
|
4814
4927
|
* @public
|
|
4815
4928
|
* @category Event
|
|
4816
4929
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "The official MongoDB driver for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -32,55 +32,55 @@
|
|
|
32
32
|
"email": "dbx-node@mongodb.com"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"bson": "^4.
|
|
35
|
+
"bson": "^4.6.1",
|
|
36
36
|
"denque": "^2.0.1",
|
|
37
|
-
"mongodb-connection-string-url": "^2.
|
|
37
|
+
"mongodb-connection-string-url": "^2.4.1",
|
|
38
|
+
"socks": "^2.6.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@istanbuljs/nyc-config-typescript": "^1.0.
|
|
41
|
-
"@microsoft/api-extractor": "^7.
|
|
41
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
42
|
+
"@microsoft/api-extractor": "^7.19.4",
|
|
42
43
|
"@microsoft/tsdoc-config": "^0.15.2",
|
|
43
|
-
"@types/chai": "^4.
|
|
44
|
+
"@types/chai": "^4.3.0",
|
|
44
45
|
"@types/chai-subset": "^1.3.3",
|
|
45
46
|
"@types/kerberos": "^1.1.1",
|
|
46
47
|
"@types/mocha": "^9.0.0",
|
|
47
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^17.0.10",
|
|
48
49
|
"@types/saslprep": "^1.0.1",
|
|
49
|
-
"@types/semver": "^7.3.
|
|
50
|
+
"@types/semver": "^7.3.9",
|
|
50
51
|
"@types/sinon": "^10.0.6",
|
|
51
52
|
"@types/whatwg-url": "^8.2.1",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
53
|
-
"@typescript-eslint/parser": "^
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
54
|
+
"@typescript-eslint/parser": "^5.10.0",
|
|
54
55
|
"bluebird": "^3.7.2",
|
|
55
56
|
"chai": "^4.3.4",
|
|
56
57
|
"chai-subset": "^1.6.0",
|
|
57
58
|
"chalk": "^4.1.2",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"eslint": "^7.32.0",
|
|
59
|
+
"downlevel-dts": "^0.8.0",
|
|
60
|
+
"eslint": "^8.7.0",
|
|
61
61
|
"eslint-config-prettier": "^8.3.0",
|
|
62
|
+
"eslint-plugin-import": "^2.25.4",
|
|
62
63
|
"eslint-plugin-prettier": "^4.0.0",
|
|
64
|
+
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
63
65
|
"eslint-plugin-tsdoc": "^0.2.14",
|
|
64
66
|
"js-yaml": "^4.1.0",
|
|
65
67
|
"lodash.camelcase": "^4.3.0",
|
|
66
|
-
"mocha": "^9.1.
|
|
68
|
+
"mocha": "^9.1.4",
|
|
67
69
|
"mocha-sinon": "^2.1.2",
|
|
68
|
-
"mongodb-mock-server": "^2.0.1",
|
|
69
70
|
"nyc": "^15.1.0",
|
|
70
|
-
"prettier": "^2.
|
|
71
|
+
"prettier": "^2.5.1",
|
|
71
72
|
"rimraf": "^3.0.2",
|
|
72
73
|
"semver": "^7.3.5",
|
|
73
74
|
"sinon": "^12.0.1",
|
|
74
75
|
"sinon-chai": "^3.7.0",
|
|
75
|
-
"source-map-support": "^0.5.
|
|
76
|
-
"standard-version": "^9.3.
|
|
77
|
-
"ts-node": "^10.
|
|
78
|
-
"tsd": "^0.
|
|
79
|
-
"
|
|
80
|
-
"typescript": "4.4.3",
|
|
76
|
+
"source-map-support": "^0.5.21",
|
|
77
|
+
"standard-version": "^9.3.2",
|
|
78
|
+
"ts-node": "^10.4.0",
|
|
79
|
+
"tsd": "^0.19.1",
|
|
80
|
+
"typescript": "^4.5.4",
|
|
81
81
|
"typescript-cached-transpile": "^0.0.6",
|
|
82
82
|
"xml2js": "^0.4.23",
|
|
83
|
-
"yargs": "^17.
|
|
83
|
+
"yargs": "^17.3.1"
|
|
84
84
|
},
|
|
85
85
|
"license": "Apache-2.0",
|
|
86
86
|
"engines": {
|
|
@@ -104,18 +104,19 @@
|
|
|
104
104
|
"check:eslint": "eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
|
|
105
105
|
"check:tsd": "tsd --version && tsd",
|
|
106
106
|
"check:dts": "./node_modules/typescript/bin/tsc --noEmit mongodb.d.ts && tsd",
|
|
107
|
-
"check:test": "mocha --file test/tools/runner
|
|
108
|
-
"check:unit": "mocha
|
|
107
|
+
"check:test": "mocha --file test/tools/runner test/integration",
|
|
108
|
+
"check:unit": "mocha test/unit/",
|
|
109
109
|
"check:ts": "./node_modules/typescript/bin/tsc -v && ./node_modules/typescript/bin/tsc --noEmit",
|
|
110
110
|
"check:atlas": "mocha --config \"test/manual/mocharc.json\" test/manual/atlas_connectivity.test.js",
|
|
111
111
|
"check:adl": "mocha --file test/tools/runner test/manual/data_lake.test.js",
|
|
112
|
-
"check:aws": "mocha --file test/tools/runner test/
|
|
112
|
+
"check:aws": "mocha --file test/tools/runner test/integration/auth/mongodb_aws.test.js",
|
|
113
113
|
"check:ocsp": "mocha --config \"test/manual/mocharc.json\" test/manual/ocsp_support.test.js",
|
|
114
114
|
"check:kerberos": "mocha --config \"test/manual/mocharc.json\" test/manual/kerberos.test.js",
|
|
115
115
|
"check:tls": "mocha --config \"test/manual/mocharc.json\" test/manual/tls_support.test.js",
|
|
116
116
|
"check:ldap": "mocha --config \"test/manual/mocharc.json\" test/manual/ldap.test.js",
|
|
117
|
-
"check:
|
|
118
|
-
"check:
|
|
117
|
+
"check:socks5": "mocha --config \"test/manual/mocharc.json\" test/manual/socks5.test.ts",
|
|
118
|
+
"check:csfle": "mocha --file test/tools/runner test/integration/client-side-encryption",
|
|
119
|
+
"check:snappy": "mocha test/unit/assorted/snappy.test.js",
|
|
119
120
|
"prepare": "node etc/prepare.js",
|
|
120
121
|
"release": "standard-version -i HISTORY.md",
|
|
121
122
|
"test": "npm run check:lint && npm run test:all",
|
package/src/admin.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import type { Document } from './bson';
|
|
2
|
+
import type { Db } from './db';
|
|
1
3
|
import { AddUserOperation, AddUserOptions } from './operations/add_user';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
ValidateCollectionOperation,
|
|
5
|
-
ValidateCollectionOptions
|
|
6
|
-
} from './operations/validate_collection';
|
|
4
|
+
import type { CommandOperationOptions } from './operations/command';
|
|
5
|
+
import { executeOperation } from './operations/execute_operation';
|
|
7
6
|
import {
|
|
8
7
|
ListDatabasesOperation,
|
|
9
8
|
ListDatabasesOptions,
|
|
10
9
|
ListDatabasesResult
|
|
11
10
|
} from './operations/list_databases';
|
|
12
|
-
import {
|
|
11
|
+
import { RemoveUserOperation, RemoveUserOptions } from './operations/remove_user';
|
|
13
12
|
import { RunCommandOperation, RunCommandOptions } from './operations/run_command';
|
|
13
|
+
import {
|
|
14
|
+
ValidateCollectionOperation,
|
|
15
|
+
ValidateCollectionOptions
|
|
16
|
+
} from './operations/validate_collection';
|
|
14
17
|
import { Callback, getTopology } from './utils';
|
|
15
|
-
import type { Document } from './bson';
|
|
16
|
-
import type { CommandOperationOptions } from './operations/command';
|
|
17
|
-
import type { Db } from './db';
|
|
18
18
|
|
|
19
19
|
/** @internal */
|
|
20
20
|
export interface AdminPrivate {
|