mongodb 4.1.4 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -15
- 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 +3 -4
- 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 +16 -18
- 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 +1 -1
- 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 +102 -15
- package/lib/cmap/connect.js.map +1 -1
- package/lib/cmap/connection.js +27 -26
- 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.map +1 -1
- package/lib/cmap/wire_protocol/constants.js +4 -4
- package/lib/cmap/wire_protocol/shared.js +4 -3
- package/lib/cmap/wire_protocol/shared.js.map +1 -1
- package/lib/collection.js +46 -47
- package/lib/collection.js.map +1 -1
- package/lib/connection_string.js +106 -49
- package/lib/connection_string.js.map +1 -1
- package/lib/constants.js +108 -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 +2 -2
- package/lib/operations/add_user.js.map +1 -1
- package/lib/operations/aggregate.js +2 -3
- 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 +9 -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 +23 -7
- 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 +11 -6
- 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 +4 -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/monitor.js +4 -4
- package/lib/sdam/monitor.js.map +1 -1
- package/lib/sdam/server.js +31 -31
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/server_description.js +1 -1
- package/lib/sdam/server_description.js.map +1 -1
- package/lib/sdam/server_selection.js +38 -3
- package/lib/sdam/server_selection.js.map +1 -1
- package/lib/sdam/srv_polling.js +11 -11
- package/lib/sdam/srv_polling.js.map +1 -1
- package/lib/sdam/topology.js +40 -62
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +36 -14
- 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 +90 -23
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +159 -65
- package/mongodb.ts34.d.ts +184 -65
- package/package.json +26 -24
- package/src/admin.ts +9 -9
- package/src/bson.ts +26 -17
- package/src/bulk/common.ts +26 -20
- package/src/bulk/ordered.ts +4 -4
- package/src/bulk/unordered.ts +5 -5
- package/src/change_stream.ts +35 -32
- package/src/cmap/auth/auth_provider.ts +3 -3
- package/src/cmap/auth/gssapi.ts +8 -8
- package/src/cmap/auth/mongo_credentials.ts +2 -6
- 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 +2 -2
- package/src/cmap/commands.ts +30 -19
- package/src/cmap/connect.ts +142 -22
- package/src/cmap/connection.ts +73 -52
- 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 +2 -2
- package/src/cmap/wire_protocol/constants.ts +4 -4
- package/src/cmap/wire_protocol/shared.ts +10 -9
- package/src/collection.ts +133 -106
- package/src/connection_string.ts +141 -60
- package/src/constants.ts +116 -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 +49 -39
- 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 +58 -32
- package/src/mongo_types.ts +98 -20
- package/src/operations/add_user.ts +6 -5
- package/src/operations/aggregate.ts +6 -7
- package/src/operations/bulk_write.ts +5 -5
- package/src/operations/collections.ts +2 -2
- package/src/operations/command.ts +19 -8
- 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 +8 -7
- 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 +30 -11
- 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 +18 -10
- package/src/operations/list_databases.ts +4 -4
- package/src/operations/map_reduce.ts +10 -9
- package/src/operations/operation.ts +8 -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 +1 -1
- package/src/sdam/monitor.ts +13 -14
- package/src/sdam/server.ts +71 -61
- package/src/sdam/server_description.ts +4 -4
- package/src/sdam/server_selection.ts +46 -3
- package/src/sdam/srv_polling.ts +15 -13
- package/src/sdam/topology.ts +89 -90
- package/src/sdam/topology_description.ts +39 -15
- package/src/sessions.ts +31 -48
- package/src/transactions.ts +6 -6
- package/src/utils.ts +123 -43
- 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.d.ts
CHANGED
|
@@ -22,10 +22,12 @@ import { Map as Map_2 } from 'bson';
|
|
|
22
22
|
import { MaxKey } from 'bson';
|
|
23
23
|
import { MinKey } from 'bson';
|
|
24
24
|
import { ObjectId } from 'bson';
|
|
25
|
+
import type { ObjectIdLike } from 'bson';
|
|
25
26
|
import { Readable } from 'stream';
|
|
26
27
|
import type { serialize as serialize_2 } from 'bson';
|
|
27
28
|
import type { SerializeOptions } from 'bson';
|
|
28
29
|
import type { Socket } from 'net';
|
|
30
|
+
import type { SrvRecord } from 'dns';
|
|
29
31
|
import type { TcpNetConnectOpts } from 'net';
|
|
30
32
|
import { Timestamp } from 'bson';
|
|
31
33
|
import type { TLSSocket } from 'tls';
|
|
@@ -644,6 +646,7 @@ export declare interface AutoEncryptionOptions {
|
|
|
644
646
|
/** Command line arguments to use when auto-spawning a mongocryptd */
|
|
645
647
|
mongocryptdSpawnArgs?: string[];
|
|
646
648
|
};
|
|
649
|
+
proxyOptions?: ProxyOptions;
|
|
647
650
|
}
|
|
648
651
|
|
|
649
652
|
/**
|
|
@@ -684,9 +687,11 @@ export { BSONRegExp }
|
|
|
684
687
|
* BSON Serialization options.
|
|
685
688
|
* @public
|
|
686
689
|
*/
|
|
687
|
-
export declare interface BSONSerializeOptions extends Omit<SerializeOptions, 'index'>, Omit<DeserializeOptions, 'evalFunctions' | 'cacheFunctions' | 'cacheFunctionsCrc32' | 'allowObjectSmallerThanBufferSize' | 'index'> {
|
|
690
|
+
export declare interface BSONSerializeOptions extends Omit<SerializeOptions, 'index'>, Omit<DeserializeOptions, 'evalFunctions' | 'cacheFunctions' | 'cacheFunctionsCrc32' | 'allowObjectSmallerThanBufferSize' | 'index' | 'validation'> {
|
|
688
691
|
/** Return BSON filled buffers from operations */
|
|
689
692
|
raw?: boolean;
|
|
693
|
+
/** Enable utf8 validation when deserializing BSON documents. Defaults to true. */
|
|
694
|
+
enableUtf8Validation?: boolean;
|
|
690
695
|
}
|
|
691
696
|
|
|
692
697
|
export { BSONSymbol }
|
|
@@ -787,8 +792,10 @@ export declare abstract class BulkOperationBase {
|
|
|
787
792
|
get bsonOptions(): BSONSerializeOptions;
|
|
788
793
|
get writeConcern(): WriteConcern | undefined;
|
|
789
794
|
get batches(): Batch[];
|
|
790
|
-
|
|
791
|
-
execute(
|
|
795
|
+
execute(options?: BulkWriteOptions): Promise<BulkWriteResult>;
|
|
796
|
+
execute(callback: Callback<BulkWriteResult>): void;
|
|
797
|
+
execute(options: BulkWriteOptions | undefined, callback: Callback<BulkWriteResult>): void;
|
|
798
|
+
execute(options?: BulkWriteOptions | Callback<BulkWriteResult>, callback?: Callback<BulkWriteResult>): Promise<BulkWriteResult> | void;
|
|
792
799
|
/* Excluded from this release type: handleWriteError */
|
|
793
800
|
abstract addToOperationsList(batchType: BatchType, document: Document | UpdateStatement | DeleteStatement): this;
|
|
794
801
|
}
|
|
@@ -909,7 +916,7 @@ export declare class CancellationToken extends TypedEventEmitter<{
|
|
|
909
916
|
* Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
|
|
910
917
|
* @public
|
|
911
918
|
*/
|
|
912
|
-
export declare class ChangeStream<TSchema extends Document = Document> extends TypedEventEmitter<ChangeStreamEvents
|
|
919
|
+
export declare class ChangeStream<TSchema extends Document = Document> extends TypedEventEmitter<ChangeStreamEvents<TSchema>> {
|
|
913
920
|
pipeline: Document[];
|
|
914
921
|
options: ChangeStreamOptions;
|
|
915
922
|
parent: MongoClient | Db | Collection;
|
|
@@ -950,7 +957,8 @@ export declare class ChangeStream<TSchema extends Document = Document> extends T
|
|
|
950
957
|
/** The cached resume token that is used to resume after the most recently returned change. */
|
|
951
958
|
get resumeToken(): ResumeToken;
|
|
952
959
|
/** Check if there is any document still available in the Change Stream */
|
|
953
|
-
hasNext(
|
|
960
|
+
hasNext(): Promise<boolean>;
|
|
961
|
+
hasNext(callback: Callback<boolean>): void;
|
|
954
962
|
/** Get the next available document from the Change Stream. */
|
|
955
963
|
next(): Promise<ChangeStreamDocument<TSchema>>;
|
|
956
964
|
next(callback: Callback<ChangeStreamDocument<TSchema>>): void;
|
|
@@ -1027,14 +1035,14 @@ export declare interface ChangeStreamDocument<TSchema extends Document = Documen
|
|
|
1027
1035
|
}
|
|
1028
1036
|
|
|
1029
1037
|
/** @public */
|
|
1030
|
-
export declare type ChangeStreamEvents = {
|
|
1038
|
+
export declare type ChangeStreamEvents<TSchema extends Document = Document> = {
|
|
1031
1039
|
resumeTokenChanged(token: ResumeToken): void;
|
|
1032
|
-
init(response:
|
|
1033
|
-
more(response?:
|
|
1040
|
+
init(response: TSchema): void;
|
|
1041
|
+
more(response?: TSchema | undefined): void;
|
|
1034
1042
|
response(): void;
|
|
1035
1043
|
end(): void;
|
|
1036
1044
|
error(error: Error): void;
|
|
1037
|
-
change(change: ChangeStreamDocument): void;
|
|
1045
|
+
change(change: ChangeStreamDocument<TSchema>): void;
|
|
1038
1046
|
} & AbstractCursorEvents;
|
|
1039
1047
|
|
|
1040
1048
|
/**
|
|
@@ -1308,10 +1316,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1308
1316
|
* @param options - Optional settings for the command
|
|
1309
1317
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1310
1318
|
*/
|
|
1311
|
-
insertOne(doc:
|
|
1312
|
-
insertOne(doc:
|
|
1313
|
-
insertOne(doc:
|
|
1314
|
-
insertOne(doc:
|
|
1319
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>): Promise<InsertOneResult<TSchema>>;
|
|
1320
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>, callback: Callback<InsertOneResult<TSchema>>): void;
|
|
1321
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>, options: InsertOneOptions): Promise<InsertOneResult<TSchema>>;
|
|
1322
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>, options: InsertOneOptions, callback: Callback<InsertOneResult<TSchema>>): void;
|
|
1315
1323
|
/**
|
|
1316
1324
|
* Inserts an array of documents into MongoDB. If documents passed in do not contain the **_id** field,
|
|
1317
1325
|
* one will be added to each of the documents missing it by the driver, mutating the document. This behavior
|
|
@@ -1321,10 +1329,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1321
1329
|
* @param options - Optional settings for the command
|
|
1322
1330
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1323
1331
|
*/
|
|
1324
|
-
insertMany(docs:
|
|
1325
|
-
insertMany(docs:
|
|
1326
|
-
insertMany(docs:
|
|
1327
|
-
insertMany(docs:
|
|
1332
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[]): Promise<InsertManyResult<TSchema>>;
|
|
1333
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[], callback: Callback<InsertManyResult<TSchema>>): void;
|
|
1334
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[], options: BulkWriteOptions): Promise<InsertManyResult<TSchema>>;
|
|
1335
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[], options: BulkWriteOptions, callback: Callback<InsertManyResult<TSchema>>): void;
|
|
1328
1336
|
/**
|
|
1329
1337
|
* Perform a bulkWrite operation without a fluent API
|
|
1330
1338
|
*
|
|
@@ -1380,10 +1388,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1380
1388
|
* @param options - Optional settings for the command
|
|
1381
1389
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1382
1390
|
*/
|
|
1383
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema): Promise<UpdateResult | Document>;
|
|
1384
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema
|
|
1385
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema
|
|
1386
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema
|
|
1391
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>): Promise<UpdateResult | Document>;
|
|
1392
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, callback: Callback<UpdateResult | Document>): void;
|
|
1393
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: ReplaceOptions): Promise<UpdateResult | Document>;
|
|
1394
|
+
replaceOne(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: ReplaceOptions, callback: Callback<UpdateResult | Document>): void;
|
|
1387
1395
|
/**
|
|
1388
1396
|
* Update multiple documents in a collection
|
|
1389
1397
|
*
|
|
@@ -1449,12 +1457,12 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1449
1457
|
* @param options - Optional settings for the command
|
|
1450
1458
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1451
1459
|
*/
|
|
1452
|
-
findOne(): Promise<TSchema | null>;
|
|
1453
|
-
findOne(callback: Callback<TSchema | null>): void;
|
|
1454
|
-
findOne(filter: Filter<TSchema>): Promise<TSchema | null>;
|
|
1455
|
-
findOne(filter: Filter<TSchema>, callback: Callback<TSchema | null>): void;
|
|
1456
|
-
findOne(filter: Filter<TSchema>, options: FindOptions): Promise<TSchema | null>;
|
|
1457
|
-
findOne(filter: Filter<TSchema>, options: FindOptions, callback: Callback<TSchema | null>): void;
|
|
1460
|
+
findOne(): Promise<WithId<TSchema> | null>;
|
|
1461
|
+
findOne(callback: Callback<WithId<TSchema> | null>): void;
|
|
1462
|
+
findOne(filter: Filter<TSchema>): Promise<WithId<TSchema> | null>;
|
|
1463
|
+
findOne(filter: Filter<TSchema>, callback: Callback<WithId<TSchema> | null>): void;
|
|
1464
|
+
findOne(filter: Filter<TSchema>, options: FindOptions): Promise<WithId<TSchema> | null>;
|
|
1465
|
+
findOne(filter: Filter<TSchema>, options: FindOptions, callback: Callback<WithId<TSchema> | null>): void;
|
|
1458
1466
|
findOne<T = TSchema>(): Promise<T | null>;
|
|
1459
1467
|
findOne<T = TSchema>(callback: Callback<T | null>): void;
|
|
1460
1468
|
findOne<T = TSchema>(filter: Filter<TSchema>): Promise<T | null>;
|
|
@@ -1465,8 +1473,8 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1465
1473
|
*
|
|
1466
1474
|
* @param filter - The filter predicate. If unspecified, then all documents in the collection will match the predicate
|
|
1467
1475
|
*/
|
|
1468
|
-
find(): FindCursor<TSchema
|
|
1469
|
-
find(filter: Filter<TSchema>, options?: FindOptions): FindCursor<TSchema
|
|
1476
|
+
find(): FindCursor<WithId<TSchema>>;
|
|
1477
|
+
find(filter: Filter<TSchema>, options?: FindOptions): FindCursor<WithId<TSchema>>;
|
|
1470
1478
|
find<T>(filter: Filter<TSchema>, options?: FindOptions): FindCursor<T>;
|
|
1471
1479
|
/**
|
|
1472
1480
|
* Returns the options of the collection.
|
|
@@ -1707,10 +1715,10 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1707
1715
|
* @param options - Optional settings for the command
|
|
1708
1716
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1709
1717
|
*/
|
|
1710
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1711
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1712
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1713
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement:
|
|
1718
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>): Promise<ModifyResult<TSchema>>;
|
|
1719
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, callback: Callback<ModifyResult<TSchema>>): void;
|
|
1720
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: FindOneAndReplaceOptions): Promise<ModifyResult<TSchema>>;
|
|
1721
|
+
findOneAndReplace(filter: Filter<TSchema>, replacement: WithoutId<TSchema>, options: FindOneAndReplaceOptions, callback: Callback<ModifyResult<TSchema>>): void;
|
|
1714
1722
|
/**
|
|
1715
1723
|
* Find a document and update it in one atomic operation. Requires a write lock for the duration of the operation.
|
|
1716
1724
|
*
|
|
@@ -1741,6 +1749,7 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1741
1749
|
/**
|
|
1742
1750
|
* Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
|
|
1743
1751
|
*
|
|
1752
|
+
* @deprecated collection.mapReduce is deprecated. Use the aggregation pipeline instead. Visit https://docs.mongodb.com/manual/reference/map-reduce-to-aggregation-pipeline for more information on how to translate map-reduce operations to the aggregation pipeline.
|
|
1744
1753
|
* @param map - The mapping function.
|
|
1745
1754
|
* @param reduce - The reduce function.
|
|
1746
1755
|
* @param options - Optional settings for the command
|
|
@@ -1767,7 +1776,7 @@ export declare class Collection<TSchema extends Document = Document> {
|
|
|
1767
1776
|
* @param options - Optional settings for the command
|
|
1768
1777
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1769
1778
|
*/
|
|
1770
|
-
insert(docs:
|
|
1779
|
+
insert(docs: OptionalUnlessRequiredId<TSchema>[], options: BulkWriteOptions, callback: Callback<InsertManyResult<TSchema>>): Promise<InsertManyResult<TSchema>> | void;
|
|
1771
1780
|
/**
|
|
1772
1781
|
* Updates documents.
|
|
1773
1782
|
*
|
|
@@ -1822,6 +1831,9 @@ export declare interface CollectionInfo extends Document {
|
|
|
1822
1831
|
|
|
1823
1832
|
/** @public */
|
|
1824
1833
|
export declare interface CollectionOptions extends BSONSerializeOptions, WriteConcernOptions, LoggerOptions {
|
|
1834
|
+
/**
|
|
1835
|
+
* @deprecated Use readPreference instead
|
|
1836
|
+
*/
|
|
1825
1837
|
slaveOk?: boolean;
|
|
1826
1838
|
/** Specify a read concern for the collection. (only MongoDB 3.2 or higher supported) */
|
|
1827
1839
|
readConcern?: ReadConcernLike;
|
|
@@ -2065,7 +2077,7 @@ export declare type ConnectionEvents = {
|
|
|
2065
2077
|
};
|
|
2066
2078
|
|
|
2067
2079
|
/** @public */
|
|
2068
|
-
export declare interface ConnectionOptions extends SupportedNodeConnectionOptions, StreamDescriptionOptions {
|
|
2080
|
+
export declare interface ConnectionOptions extends SupportedNodeConnectionOptions, StreamDescriptionOptions, ProxyOptions {
|
|
2069
2081
|
id: number | '<monitor>';
|
|
2070
2082
|
generation: number;
|
|
2071
2083
|
hostAddress: HostAddress;
|
|
@@ -2324,7 +2336,15 @@ export declare class Db {
|
|
|
2324
2336
|
constructor(client: MongoClient, databaseName: string, options?: DbOptions);
|
|
2325
2337
|
get databaseName(): string;
|
|
2326
2338
|
get options(): DbOptions | undefined;
|
|
2339
|
+
/**
|
|
2340
|
+
* slaveOk specified
|
|
2341
|
+
* @deprecated Use secondaryOk instead
|
|
2342
|
+
*/
|
|
2327
2343
|
get slaveOk(): boolean;
|
|
2344
|
+
/**
|
|
2345
|
+
* Check if a secondary can be used (because the read preference is *not* set to primary)
|
|
2346
|
+
*/
|
|
2347
|
+
get secondaryOk(): boolean;
|
|
2328
2348
|
get readConcern(): ReadConcern | undefined;
|
|
2329
2349
|
/**
|
|
2330
2350
|
* The current readPreference of the Db. If not explicitly defined for
|
|
@@ -2342,10 +2362,9 @@ export declare class Db {
|
|
|
2342
2362
|
* @param options - Optional settings for the command
|
|
2343
2363
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
2344
2364
|
*/
|
|
2345
|
-
createCollection<TSchema extends Document = Document>(name: string): Promise<Collection<TSchema>>;
|
|
2365
|
+
createCollection<TSchema extends Document = Document>(name: string, options?: CreateCollectionOptions): Promise<Collection<TSchema>>;
|
|
2346
2366
|
createCollection<TSchema extends Document = Document>(name: string, callback: Callback<Collection<TSchema>>): void;
|
|
2347
|
-
createCollection<TSchema extends Document = Document>(name: string, options: CreateCollectionOptions
|
|
2348
|
-
createCollection<TSchema extends Document = Document>(name: string, options: CreateCollectionOptions, callback: Callback<Collection<TSchema>>): void;
|
|
2367
|
+
createCollection<TSchema extends Document = Document>(name: string, options: CreateCollectionOptions | undefined, callback: Callback<Collection<TSchema>>): void;
|
|
2349
2368
|
/**
|
|
2350
2369
|
* Execute a command
|
|
2351
2370
|
*
|
|
@@ -2733,8 +2752,8 @@ export declare type ExplainVerbosityLike = ExplainVerbosity | boolean;
|
|
|
2733
2752
|
|
|
2734
2753
|
/** A MongoDB filter can be some portion of the schema or a set of operators @public */
|
|
2735
2754
|
export declare type Filter<TSchema> = {
|
|
2736
|
-
[
|
|
2737
|
-
} & RootFilterOperators<TSchema
|
|
2755
|
+
[Property in Join<NestedPaths<WithId<TSchema>>, '.'>]?: Condition<PropertyType<WithId<TSchema>, Property>>;
|
|
2756
|
+
} & RootFilterOperators<WithId<TSchema>>;
|
|
2738
2757
|
|
|
2739
2758
|
/** @public */
|
|
2740
2759
|
export declare type FilterOperations<T> = T extends Record<string, any> ? {
|
|
@@ -2742,7 +2761,7 @@ export declare type FilterOperations<T> = T extends Record<string, any> ? {
|
|
|
2742
2761
|
} : FilterOperators<T>;
|
|
2743
2762
|
|
|
2744
2763
|
/** @public */
|
|
2745
|
-
export declare interface FilterOperators<TValue> extends
|
|
2764
|
+
export declare interface FilterOperators<TValue> extends NonObjectIdLikeDocument {
|
|
2746
2765
|
$eq?: TValue;
|
|
2747
2766
|
$gt?: TValue;
|
|
2748
2767
|
$gte?: TValue;
|
|
@@ -3032,7 +3051,7 @@ export declare interface FindOptions<TSchema extends Document = Document> extend
|
|
|
3032
3051
|
timeout?: boolean;
|
|
3033
3052
|
/** Specify if the cursor is tailable. */
|
|
3034
3053
|
tailable?: boolean;
|
|
3035
|
-
/** Specify if the cursor is a
|
|
3054
|
+
/** Specify if the cursor is a tailable-await cursor. Requires `tailable` to be true */
|
|
3036
3055
|
awaitData?: boolean;
|
|
3037
3056
|
/** Set the batchSize for the getMoreCommand when iterating over the query results. */
|
|
3038
3057
|
batchSize?: number;
|
|
@@ -3302,12 +3321,12 @@ export declare class GridFSBucketWriteStream extends Writable implements NodeJS.
|
|
|
3302
3321
|
* @param encoding - Optional encoding for the buffer
|
|
3303
3322
|
* @param callback - Function to call when all files and chunks have been persisted to MongoDB
|
|
3304
3323
|
*/
|
|
3305
|
-
end():
|
|
3306
|
-
end(chunk: Buffer):
|
|
3307
|
-
end(callback: Callback<GridFSFile | void>):
|
|
3308
|
-
end(chunk: Buffer, callback: Callback<GridFSFile | void>):
|
|
3309
|
-
end(chunk: Buffer, encoding: BufferEncoding):
|
|
3310
|
-
end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>):
|
|
3324
|
+
end(): this;
|
|
3325
|
+
end(chunk: Buffer): this;
|
|
3326
|
+
end(callback: Callback<GridFSFile | void>): this;
|
|
3327
|
+
end(chunk: Buffer, callback: Callback<GridFSFile | void>): this;
|
|
3328
|
+
end(chunk: Buffer, encoding: BufferEncoding): this;
|
|
3329
|
+
end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>): this;
|
|
3311
3330
|
}
|
|
3312
3331
|
|
|
3313
3332
|
/** @public */
|
|
@@ -3360,11 +3379,14 @@ export declare class HostAddress {
|
|
|
3360
3379
|
socketPath: string | undefined;
|
|
3361
3380
|
isIPv6: boolean | undefined;
|
|
3362
3381
|
constructor(hostString: string);
|
|
3382
|
+
inspect(): string;
|
|
3363
3383
|
/**
|
|
3364
3384
|
* @param ipv6Brackets - optionally request ipv6 bracket notation required for connection strings
|
|
3365
3385
|
*/
|
|
3366
3386
|
toString(ipv6Brackets?: boolean): string;
|
|
3367
3387
|
static fromString(s: string): HostAddress;
|
|
3388
|
+
static fromHostPort(host: string, port: number): HostAddress;
|
|
3389
|
+
static fromSrvRecord({ name, port }: SrvRecord): HostAddress;
|
|
3368
3390
|
}
|
|
3369
3391
|
|
|
3370
3392
|
/** @public */
|
|
@@ -3394,7 +3416,9 @@ export declare type IndexSpecification = OneOrMore<string | [string, IndexDirect
|
|
|
3394
3416
|
/** Given an object shaped type, return the type of the _id field or default to ObjectId @public */
|
|
3395
3417
|
export declare type InferIdType<TSchema> = TSchema extends {
|
|
3396
3418
|
_id: infer IdType;
|
|
3397
|
-
} ?
|
|
3419
|
+
} ? Record<any, never> extends IdType ? never : IdType : TSchema extends {
|
|
3420
|
+
_id?: infer IdType;
|
|
3421
|
+
} ? unknown extends IdType ? ObjectId : IdType : ObjectId;
|
|
3398
3422
|
|
|
3399
3423
|
/** @public */
|
|
3400
3424
|
export declare interface InsertManyResult<TSchema = Document> {
|
|
@@ -3442,6 +3466,12 @@ export declare type IntegerType = number | Int32 | Long;
|
|
|
3442
3466
|
/** @public */
|
|
3443
3467
|
export declare type IsAny<Type, ResultIfAny, ResultIfNotAny> = true extends false & Type ? ResultIfAny : ResultIfNotAny;
|
|
3444
3468
|
|
|
3469
|
+
/**
|
|
3470
|
+
* Helper types for dot-notation filter attributes
|
|
3471
|
+
*/
|
|
3472
|
+
/** @public */
|
|
3473
|
+
export declare type Join<T extends unknown[], D extends string> = T extends [] ? '' : T extends [string | number] ? `${T[0]}` : T extends [string | number, ...infer R] ? `${T[0]}${D}${Join<R, D>}` : string;
|
|
3474
|
+
|
|
3445
3475
|
/* Excluded from this release type: kBeforeHandshake */
|
|
3446
3476
|
|
|
3447
3477
|
/* Excluded from this release type: kBuffer */
|
|
@@ -3602,6 +3632,8 @@ export declare class ListCollectionsCursor<T extends Pick<CollectionInfo, 'name'
|
|
|
3602
3632
|
export declare interface ListCollectionsOptions extends CommandOperationOptions {
|
|
3603
3633
|
/** Since 4.0: If true, will only return the collection name in the response, and will omit additional info */
|
|
3604
3634
|
nameOnly?: boolean;
|
|
3635
|
+
/** Since 4.0: If true and nameOnly is true, allows a user without the required privilege (i.e. listCollections action on the database) to run the command when access control is enforced. */
|
|
3636
|
+
authorizedCollections?: boolean;
|
|
3605
3637
|
/** The batchSize for the returned command cursor or if pre 2.8 the systems batch collection */
|
|
3606
3638
|
batchSize?: number;
|
|
3607
3639
|
}
|
|
@@ -3797,7 +3829,7 @@ export declare interface ModifyResult<TSchema = Document> {
|
|
|
3797
3829
|
}
|
|
3798
3830
|
|
|
3799
3831
|
/** @public */
|
|
3800
|
-
export declare const MONGO_CLIENT_EVENTS: readonly ["connectionPoolCreated", "connectionPoolClosed", "connectionCreated", "connectionReady", "connectionClosed", "connectionCheckOutStarted", "connectionCheckOutFailed", "connectionCheckedOut", "connectionCheckedIn", "connectionPoolCleared",
|
|
3832
|
+
export declare const MONGO_CLIENT_EVENTS: readonly ["connectionPoolCreated", "connectionPoolClosed", "connectionCreated", "connectionReady", "connectionClosed", "connectionCheckOutStarted", "connectionCheckOutFailed", "connectionCheckedOut", "connectionCheckedIn", "connectionPoolCleared", "commandStarted", "commandSucceeded", "commandFailed", "serverOpening", "serverClosed", "serverDescriptionChanged", "topologyOpening", "topologyClosed", "topologyDescriptionChanged", "error", "timeout", "close", "serverHeartbeatStarted", "serverHeartbeatSucceeded", "serverHeartbeatFailed"];
|
|
3801
3833
|
|
|
3802
3834
|
/**
|
|
3803
3835
|
* An error generated when the driver API is used incorrectly
|
|
@@ -3932,8 +3964,8 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> {
|
|
|
3932
3964
|
*
|
|
3933
3965
|
* @see docs.mongodb.org/manual/reference/connection-string/
|
|
3934
3966
|
*/
|
|
3935
|
-
connect(): Promise<
|
|
3936
|
-
connect(callback: Callback<
|
|
3967
|
+
connect(): Promise<this>;
|
|
3968
|
+
connect(callback: Callback<this>): void;
|
|
3937
3969
|
/**
|
|
3938
3970
|
* Close the db and its underlying connections
|
|
3939
3971
|
*
|
|
@@ -4029,6 +4061,16 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
4029
4061
|
compressors?: CompressorName[] | string;
|
|
4030
4062
|
/** An integer that specifies the compression level if using zlib for network compression. */
|
|
4031
4063
|
zlibCompressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
|
|
4064
|
+
/** The maximum number of hosts to connect to when using an srv connection string, a setting of `0` means unlimited hosts */
|
|
4065
|
+
srvMaxHosts?: number;
|
|
4066
|
+
/**
|
|
4067
|
+
* Modifies the srv URI to look like:
|
|
4068
|
+
*
|
|
4069
|
+
* `_{srvServiceName}._tcp.{hostname}.{domainname}`
|
|
4070
|
+
*
|
|
4071
|
+
* Querying this DNS URI is expected to respond with SRV records
|
|
4072
|
+
*/
|
|
4073
|
+
srvServiceName?: string;
|
|
4032
4074
|
/** The maximum number of connections in the connection pool. */
|
|
4033
4075
|
maxPoolSize?: number;
|
|
4034
4076
|
/** The minimum number of connections in the connection pool. */
|
|
@@ -4131,6 +4173,14 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
4131
4173
|
autoEncryption?: AutoEncryptionOptions;
|
|
4132
4174
|
/** Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver */
|
|
4133
4175
|
driverInfo?: DriverInfo;
|
|
4176
|
+
/** Configures a Socks5 proxy host used for creating TCP connections. */
|
|
4177
|
+
proxyHost?: string;
|
|
4178
|
+
/** Configures a Socks5 proxy port used for creating TCP connections. */
|
|
4179
|
+
proxyPort?: number;
|
|
4180
|
+
/** Configures a Socks5 proxy username when the proxy in proxyHost requires username/password authentication. */
|
|
4181
|
+
proxyUsername?: string;
|
|
4182
|
+
/** Configures a Socks5 proxy password when the proxy in proxyHost requires username/password authentication. */
|
|
4183
|
+
proxyPassword?: string;
|
|
4134
4184
|
/* Excluded from this release type: srvPoller */
|
|
4135
4185
|
/* Excluded from this release type: connectionType */
|
|
4136
4186
|
}
|
|
@@ -4411,7 +4461,7 @@ export declare class MongoNotConnectedError extends MongoAPIError {
|
|
|
4411
4461
|
* Mongo Client Options
|
|
4412
4462
|
* @public
|
|
4413
4463
|
*/
|
|
4414
|
-
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 {
|
|
4464
|
+
export declare interface MongoOptions extends Required<Pick<MongoClientOptions, 'autoEncryption' | 'connectTimeoutMS' | 'directConnection' | 'driverInfo' | 'forceServerObjectId' | 'minHeartbeatFrequencyMS' | 'heartbeatFrequencyMS' | 'keepAlive' | 'keepAliveInitialDelay' | 'localThresholdMS' | 'logger' | 'maxIdleTimeMS' | 'maxPoolSize' | 'minPoolSize' | 'monitorCommands' | 'noDelay' | 'pkFactory' | 'promiseLibrary' | 'raw' | 'replicaSet' | 'retryReads' | 'retryWrites' | 'serverSelectionTimeoutMS' | 'socketTimeoutMS' | 'srvMaxHosts' | 'srvServiceName' | 'tlsAllowInvalidCertificates' | 'tlsAllowInvalidHostnames' | 'tlsInsecure' | 'waitQueueTimeoutMS' | 'zlibCompressionLevel'>>, SupportedNodeConnectionOptions {
|
|
4415
4465
|
hosts: HostAddress[];
|
|
4416
4466
|
srvHost?: string;
|
|
4417
4467
|
credentials?: MongoCredentials;
|
|
@@ -4424,6 +4474,10 @@ export declare interface MongoOptions extends Required<Pick<MongoClientOptions,
|
|
|
4424
4474
|
dbName: string;
|
|
4425
4475
|
metadata: ClientMetadata;
|
|
4426
4476
|
autoEncrypter?: AutoEncrypter;
|
|
4477
|
+
proxyHost?: string;
|
|
4478
|
+
proxyPort?: number;
|
|
4479
|
+
proxyUsername?: string;
|
|
4480
|
+
proxyPassword?: string;
|
|
4427
4481
|
/* Excluded from this release type: connectionType */
|
|
4428
4482
|
/* Excluded from this release type: encrypter */
|
|
4429
4483
|
/* Excluded from this release type: userSpecifiedAuthSource */
|
|
@@ -4587,6 +4641,21 @@ export declare interface MonitorOptions extends Omit<ConnectionOptions, 'id' | '
|
|
|
4587
4641
|
|
|
4588
4642
|
/* Excluded from this release type: Msg */
|
|
4589
4643
|
|
|
4644
|
+
/** @public */
|
|
4645
|
+
export declare type NestedPaths<Type> = Type extends string | number | boolean | Date | RegExp | Buffer | Uint8Array | ((...args: any[]) => any) | {
|
|
4646
|
+
_bsontype: string;
|
|
4647
|
+
} ? [] : Type extends ReadonlyArray<infer ArrayType> ? [number, ...NestedPaths<ArrayType>] : Type extends Map<string, any> ? [string] : Type extends object ? {
|
|
4648
|
+
[Key in Extract<keyof Type, string>]: [Key, ...NestedPaths<Type[Key]>];
|
|
4649
|
+
}[Extract<keyof Type, string>] : [];
|
|
4650
|
+
|
|
4651
|
+
/**
|
|
4652
|
+
* @public
|
|
4653
|
+
* A type that extends Document but forbids anything that "looks like" an object id.
|
|
4654
|
+
*/
|
|
4655
|
+
export declare type NonObjectIdLikeDocument = {
|
|
4656
|
+
[key in keyof ObjectIdLike]?: never;
|
|
4657
|
+
} & Document;
|
|
4658
|
+
|
|
4590
4659
|
/** It avoids using fields with not acceptable types @public */
|
|
4591
4660
|
export declare type NotAcceptedFields<TSchema, FieldType> = {
|
|
4592
4661
|
readonly [key in KeysOfOtherType<TSchema, FieldType>]?: never;
|
|
@@ -4619,6 +4688,7 @@ export declare interface OperationOptions extends BSONSerializeOptions {
|
|
|
4619
4688
|
/** The preferred read preference (ReadPreference.primary, ReadPreference.primary_preferred, ReadPreference.secondary, ReadPreference.secondary_preferred, ReadPreference.nearest). */
|
|
4620
4689
|
readPreference?: ReadPreferenceLike;
|
|
4621
4690
|
/* Excluded from this release type: bypassPinningCheck */
|
|
4691
|
+
omitReadPreference?: boolean;
|
|
4622
4692
|
}
|
|
4623
4693
|
|
|
4624
4694
|
/* Excluded from this release type: OperationParent */
|
|
@@ -4638,19 +4708,25 @@ export declare type OperationTime = Timestamp;
|
|
|
4638
4708
|
/**
|
|
4639
4709
|
* Add an optional _id field to an object shaped type
|
|
4640
4710
|
* @public
|
|
4711
|
+
*/
|
|
4712
|
+
export declare type OptionalId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
|
|
4713
|
+
_id?: InferIdType<TSchema>;
|
|
4714
|
+
};
|
|
4715
|
+
|
|
4716
|
+
/**
|
|
4717
|
+
* Adds an optional _id field to an object shaped type, unless the _id field is requried on that type.
|
|
4718
|
+
* In the case _id is required, this method continues to require_id.
|
|
4719
|
+
*
|
|
4720
|
+
* @public
|
|
4641
4721
|
*
|
|
4642
4722
|
* @privateRemarks
|
|
4643
4723
|
* `ObjectId extends TSchema['_id']` is a confusing ordering at first glance. Rather than ask
|
|
4644
4724
|
* `TSchema['_id'] extends ObjectId` which translated to "Is the _id property ObjectId?"
|
|
4645
4725
|
* we instead ask "Does ObjectId look like (have the same shape) as the _id?"
|
|
4646
4726
|
*/
|
|
4647
|
-
export declare type
|
|
4648
|
-
_id
|
|
4649
|
-
} ?
|
|
4650
|
-
_id?: InferIdType<TSchema>;
|
|
4651
|
-
} : WithId<TSchema> : EnhancedOmit<TSchema, '_id'> & {
|
|
4652
|
-
_id?: InferIdType<TSchema>;
|
|
4653
|
-
};
|
|
4727
|
+
export declare type OptionalUnlessRequiredId<TSchema> = TSchema extends {
|
|
4728
|
+
_id: any;
|
|
4729
|
+
} ? TSchema : OptionalId<TSchema>;
|
|
4654
4730
|
|
|
4655
4731
|
/** @public */
|
|
4656
4732
|
export declare class OrderedBulkOperation extends BulkOperationBase {
|
|
@@ -4708,6 +4784,17 @@ declare class Promise_2 {
|
|
|
4708
4784
|
}
|
|
4709
4785
|
export { Promise_2 as Promise }
|
|
4710
4786
|
|
|
4787
|
+
/** @public */
|
|
4788
|
+
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;
|
|
4789
|
+
|
|
4790
|
+
/** @public */
|
|
4791
|
+
export declare interface ProxyOptions {
|
|
4792
|
+
proxyHost?: string;
|
|
4793
|
+
proxyPort?: number;
|
|
4794
|
+
proxyUsername?: string;
|
|
4795
|
+
proxyPassword?: string;
|
|
4796
|
+
}
|
|
4797
|
+
|
|
4711
4798
|
/** @public */
|
|
4712
4799
|
export declare type PullAllOperator<TSchema> = ({
|
|
4713
4800
|
readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: TSchema[key];
|
|
@@ -4831,11 +4918,16 @@ export declare class ReadPreference {
|
|
|
4831
4918
|
*/
|
|
4832
4919
|
isValid(mode?: string): boolean;
|
|
4833
4920
|
/**
|
|
4834
|
-
* Indicates that this readPreference needs the "
|
|
4835
|
-
*
|
|
4921
|
+
* Indicates that this readPreference needs the "secondaryOk" bit when sent over the wire
|
|
4922
|
+
* @deprecated Use secondaryOk instead
|
|
4836
4923
|
* @see https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-query
|
|
4837
4924
|
*/
|
|
4838
4925
|
slaveOk(): boolean;
|
|
4926
|
+
/**
|
|
4927
|
+
* Indicates that this readPreference needs the "SecondaryOk" bit when sent over the wire
|
|
4928
|
+
* @see https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-query
|
|
4929
|
+
*/
|
|
4930
|
+
secondaryOk(): boolean;
|
|
4839
4931
|
/**
|
|
4840
4932
|
* Check if the two ReadPreferences are equivalent
|
|
4841
4933
|
*
|
|
@@ -4908,7 +5000,7 @@ export declare interface ReplaceOneModel<TSchema extends Document = Document> {
|
|
|
4908
5000
|
/** The filter to limit the replaced document. */
|
|
4909
5001
|
filter: Filter<TSchema>;
|
|
4910
5002
|
/** The document with which to replace the matched document. */
|
|
4911
|
-
replacement: TSchema
|
|
5003
|
+
replacement: WithoutId<TSchema>;
|
|
4912
5004
|
/** Specifies a collation. */
|
|
4913
5005
|
collation?: CollationOptions;
|
|
4914
5006
|
/** The index to use. If specified, then the query system will only consider plans using the hinted index. */
|
|
@@ -5328,7 +5420,7 @@ export declare type TagSet = {
|
|
|
5328
5420
|
export declare interface TimeSeriesCollectionOptions extends Document {
|
|
5329
5421
|
timeField: string;
|
|
5330
5422
|
metaField?: string;
|
|
5331
|
-
granularity?: string;
|
|
5423
|
+
granularity?: 'seconds' | 'minutes' | 'hours' | string;
|
|
5332
5424
|
}
|
|
5333
5425
|
|
|
5334
5426
|
export { Timestamp }
|
|
@@ -5430,6 +5522,8 @@ export declare class TopologyOpeningEvent {
|
|
|
5430
5522
|
|
|
5431
5523
|
/** @public */
|
|
5432
5524
|
export declare interface TopologyOptions extends BSONSerializeOptions, ServerOptions {
|
|
5525
|
+
srvMaxHosts: number;
|
|
5526
|
+
srvServiceName: string;
|
|
5433
5527
|
hosts: HostAddress[];
|
|
5434
5528
|
retryWrites: boolean;
|
|
5435
5529
|
retryReads: boolean;
|
|
@@ -5502,7 +5596,7 @@ export declare class Transaction {
|
|
|
5502
5596
|
*/
|
|
5503
5597
|
export declare interface TransactionOptions extends CommandOperationOptions {
|
|
5504
5598
|
/** A default read concern for commands in this transaction */
|
|
5505
|
-
readConcern?:
|
|
5599
|
+
readConcern?: ReadConcernLike;
|
|
5506
5600
|
/** A default writeConcern for commands in this transaction */
|
|
5507
5601
|
writeConcern?: WriteConcern;
|
|
5508
5602
|
/** A default read preference for commands in this transaction */
|