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/src/mongo_client.ts
CHANGED
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TcpNetConnectOpts } from 'net';
|
|
2
|
+
import type { ConnectionOptions as TLSConnectionOptions, TLSSocketOptions } from 'tls';
|
|
3
|
+
|
|
4
|
+
import { BSONSerializeOptions, Document, resolveBSONOptions } from './bson';
|
|
2
5
|
import { ChangeStream, ChangeStreamOptions } from './change_stream';
|
|
3
|
-
import type {
|
|
6
|
+
import type { AuthMechanismProperties, MongoCredentials } from './cmap/auth/mongo_credentials';
|
|
7
|
+
import type { AuthMechanism } from './cmap/auth/providers';
|
|
8
|
+
import type { LEGAL_TCP_SOCKET_OPTIONS, LEGAL_TLS_SOCKET_OPTIONS } from './cmap/connect';
|
|
9
|
+
import type { Connection } from './cmap/connection';
|
|
10
|
+
import type { CompressorName } from './cmap/wire_protocol/compression';
|
|
11
|
+
import { parseOptions } from './connection_string';
|
|
12
|
+
import type { MONGO_CLIENT_EVENTS } from './constants';
|
|
13
|
+
import { Db, DbOptions } from './db';
|
|
14
|
+
import type { AutoEncrypter, AutoEncryptionOptions } from './deps';
|
|
15
|
+
import type { Encrypter } from './encrypter';
|
|
4
16
|
import {
|
|
5
17
|
AnyError,
|
|
6
|
-
MongoRuntimeError,
|
|
7
18
|
MongoInvalidArgumentError,
|
|
8
|
-
MongoNotConnectedError
|
|
19
|
+
MongoNotConnectedError,
|
|
20
|
+
MongoRuntimeError
|
|
9
21
|
} from './error';
|
|
10
|
-
import type {
|
|
22
|
+
import type { Logger, LoggerLevel } from './logger';
|
|
23
|
+
import { TypedEventEmitter } from './mongo_types';
|
|
24
|
+
import { connect } from './operations/connect';
|
|
25
|
+
import { PromiseProvider } from './promise_provider';
|
|
26
|
+
import type { ReadConcern, ReadConcernLevel, ReadConcernLike } from './read_concern';
|
|
27
|
+
import type { ReadPreference, ReadPreferenceMode } from './read_preference';
|
|
28
|
+
import type { TagSet } from './sdam/server_description';
|
|
29
|
+
import type { SrvPoller } from './sdam/srv_polling';
|
|
30
|
+
import type { Topology, TopologyEvents } from './sdam/topology';
|
|
31
|
+
import type { ClientSession, ClientSessionOptions } from './sessions';
|
|
11
32
|
import {
|
|
12
|
-
maybePromise,
|
|
13
|
-
MongoDBNamespace,
|
|
14
33
|
Callback,
|
|
15
|
-
resolveOptions,
|
|
16
34
|
ClientMetadata,
|
|
35
|
+
HostAddress,
|
|
36
|
+
maybePromise,
|
|
37
|
+
MongoDBNamespace,
|
|
17
38
|
ns,
|
|
18
|
-
|
|
39
|
+
resolveOptions
|
|
19
40
|
} from './utils';
|
|
20
|
-
import {
|
|
21
|
-
import { PromiseProvider } from './promise_provider';
|
|
22
|
-
import type { Logger, LoggerLevel } from './logger';
|
|
23
|
-
import type { ReadConcern, ReadConcernLevel, ReadConcernLike } from './read_concern';
|
|
24
|
-
import { BSONSerializeOptions, Document, resolveBSONOptions } from './bson';
|
|
25
|
-
import type { AutoEncrypter, AutoEncryptionOptions } from './deps';
|
|
26
|
-
import type { AuthMechanism } from './cmap/auth/defaultAuthProviders';
|
|
27
|
-
import type { Topology, TopologyEvents } from './sdam/topology';
|
|
28
|
-
import type { ClientSession, ClientSessionOptions } from './sessions';
|
|
29
|
-
import type { TagSet } from './sdam/server_description';
|
|
30
|
-
import type { AuthMechanismProperties, MongoCredentials } from './cmap/auth/mongo_credentials';
|
|
31
|
-
import { parseOptions } from './connection_string';
|
|
32
|
-
import type { CompressorName } from './cmap/wire_protocol/compression';
|
|
33
|
-
import type { TLSSocketOptions, ConnectionOptions as TLSConnectionOptions } from 'tls';
|
|
34
|
-
import type { TcpNetConnectOpts } from 'net';
|
|
35
|
-
import type { SrvPoller } from './sdam/srv_polling';
|
|
36
|
-
import type { Connection } from './cmap/connection';
|
|
37
|
-
import type { LEGAL_TLS_SOCKET_OPTIONS, LEGAL_TCP_SOCKET_OPTIONS } from './cmap/connect';
|
|
38
|
-
import type { Encrypter } from './encrypter';
|
|
39
|
-
import { TypedEventEmitter } from './mongo_types';
|
|
41
|
+
import type { W, WriteConcern } from './write_concern';
|
|
40
42
|
|
|
41
43
|
/** @public */
|
|
42
44
|
export const ServerApiVersion = Object.freeze({
|
|
@@ -132,6 +134,16 @@ export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeC
|
|
|
132
134
|
compressors?: CompressorName[] | string;
|
|
133
135
|
/** An integer that specifies the compression level if using zlib for network compression. */
|
|
134
136
|
zlibCompressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
|
|
137
|
+
/** The maximum number of hosts to connect to when using an srv connection string, a setting of `0` means unlimited hosts */
|
|
138
|
+
srvMaxHosts?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Modifies the srv URI to look like:
|
|
141
|
+
*
|
|
142
|
+
* `_{srvServiceName}._tcp.{hostname}.{domainname}`
|
|
143
|
+
*
|
|
144
|
+
* Querying this DNS URI is expected to respond with SRV records
|
|
145
|
+
*/
|
|
146
|
+
srvServiceName?: string;
|
|
135
147
|
/** The maximum number of connections in the connection pool. */
|
|
136
148
|
maxPoolSize?: number;
|
|
137
149
|
/** The minimum number of connections in the connection pool. */
|
|
@@ -236,6 +248,14 @@ export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeC
|
|
|
236
248
|
autoEncryption?: AutoEncryptionOptions;
|
|
237
249
|
/** Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver */
|
|
238
250
|
driverInfo?: DriverInfo;
|
|
251
|
+
/** Configures a Socks5 proxy host used for creating TCP connections. */
|
|
252
|
+
proxyHost?: string;
|
|
253
|
+
/** Configures a Socks5 proxy port used for creating TCP connections. */
|
|
254
|
+
proxyPort?: number;
|
|
255
|
+
/** Configures a Socks5 proxy username when the proxy in proxyHost requires username/password authentication. */
|
|
256
|
+
proxyUsername?: string;
|
|
257
|
+
/** Configures a Socks5 proxy password when the proxy in proxyHost requires username/password authentication. */
|
|
258
|
+
proxyPassword?: string;
|
|
239
259
|
|
|
240
260
|
/** @internal */
|
|
241
261
|
srvPoller?: SrvPoller;
|
|
@@ -401,9 +421,9 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
|
|
|
401
421
|
*
|
|
402
422
|
* @see docs.mongodb.org/manual/reference/connection-string/
|
|
403
423
|
*/
|
|
404
|
-
connect(): Promise<
|
|
405
|
-
connect(callback: Callback<
|
|
406
|
-
connect(callback?: Callback<
|
|
424
|
+
connect(): Promise<this>;
|
|
425
|
+
connect(callback: Callback<this>): void;
|
|
426
|
+
connect(callback?: Callback<this>): Promise<this> | void {
|
|
407
427
|
if (callback && typeof callback !== 'function') {
|
|
408
428
|
throw new MongoInvalidArgumentError('Method `connect` only accepts a callback');
|
|
409
429
|
}
|
|
@@ -643,6 +663,8 @@ export interface MongoOptions
|
|
|
643
663
|
| 'retryWrites'
|
|
644
664
|
| 'serverSelectionTimeoutMS'
|
|
645
665
|
| 'socketTimeoutMS'
|
|
666
|
+
| 'srvMaxHosts'
|
|
667
|
+
| 'srvServiceName'
|
|
646
668
|
| 'tlsAllowInvalidCertificates'
|
|
647
669
|
| 'tlsAllowInvalidHostnames'
|
|
648
670
|
| 'tlsInsecure'
|
|
@@ -663,6 +685,10 @@ export interface MongoOptions
|
|
|
663
685
|
dbName: string;
|
|
664
686
|
metadata: ClientMetadata;
|
|
665
687
|
autoEncrypter?: AutoEncrypter;
|
|
688
|
+
proxyHost?: string;
|
|
689
|
+
proxyPort?: number;
|
|
690
|
+
proxyUsername?: string;
|
|
691
|
+
proxyPassword?: string;
|
|
666
692
|
/** @internal */
|
|
667
693
|
connectionType?: typeof Connection;
|
|
668
694
|
|
package/src/mongo_types.ts
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
|
+
import type { ObjectIdLike } from 'bson';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
|
|
1
4
|
import type {
|
|
2
5
|
Binary,
|
|
3
|
-
Document,
|
|
4
|
-
ObjectId,
|
|
5
6
|
BSONRegExp,
|
|
6
|
-
Timestamp,
|
|
7
7
|
Decimal128,
|
|
8
|
+
Document,
|
|
8
9
|
Double,
|
|
9
10
|
Int32,
|
|
10
|
-
Long
|
|
11
|
+
Long,
|
|
12
|
+
ObjectId,
|
|
13
|
+
Timestamp
|
|
11
14
|
} from './bson';
|
|
12
|
-
import { EventEmitter } from 'events';
|
|
13
15
|
import type { Sort } from './sort';
|
|
14
16
|
|
|
15
17
|
/** @internal */
|
|
16
18
|
export type TODO_NODE_3286 = any;
|
|
17
19
|
|
|
18
20
|
/** Given an object shaped type, return the type of the _id field or default to ObjectId @public */
|
|
19
|
-
export type InferIdType<TSchema> = TSchema extends { _id: infer IdType }
|
|
20
|
-
? //
|
|
21
|
-
|
|
22
|
-
? //
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
export type InferIdType<TSchema> = TSchema extends { _id: infer IdType }
|
|
22
|
+
? // user has defined a type for _id
|
|
23
|
+
Record<any, never> extends IdType
|
|
24
|
+
? never // explicitly forbid empty objects as the type of _id
|
|
25
|
+
: IdType
|
|
26
|
+
: TSchema extends { _id?: infer IdType }
|
|
27
|
+
? // optional _id defined - return ObjectId | IdType
|
|
28
|
+
unknown extends IdType
|
|
29
|
+
? ObjectId // infer the _id type as ObjectId if the type of _id is unknown
|
|
26
30
|
: IdType
|
|
27
31
|
: ObjectId; // user has not defined _id on schema
|
|
28
32
|
|
|
@@ -32,17 +36,23 @@ export type WithId<TSchema> = EnhancedOmit<TSchema, '_id'> & { _id: InferIdType<
|
|
|
32
36
|
/**
|
|
33
37
|
* Add an optional _id field to an object shaped type
|
|
34
38
|
* @public
|
|
39
|
+
*/
|
|
40
|
+
export type OptionalId<TSchema> = EnhancedOmit<TSchema, '_id'> & { _id?: InferIdType<TSchema> };
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Adds an optional _id field to an object shaped type, unless the _id field is requried on that type.
|
|
44
|
+
* In the case _id is required, this method continues to require_id.
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
35
47
|
*
|
|
36
48
|
* @privateRemarks
|
|
37
49
|
* `ObjectId extends TSchema['_id']` is a confusing ordering at first glance. Rather than ask
|
|
38
50
|
* `TSchema['_id'] extends ObjectId` which translated to "Is the _id property ObjectId?"
|
|
39
51
|
* we instead ask "Does ObjectId look like (have the same shape) as the _id?"
|
|
40
52
|
*/
|
|
41
|
-
export type
|
|
42
|
-
?
|
|
43
|
-
|
|
44
|
-
: WithId<TSchema>
|
|
45
|
-
: EnhancedOmit<TSchema, '_id'> & { _id?: InferIdType<TSchema> }; // TODO(NODE-3285): Improve type readability
|
|
53
|
+
export type OptionalUnlessRequiredId<TSchema> = TSchema extends { _id: any }
|
|
54
|
+
? TSchema
|
|
55
|
+
: OptionalId<TSchema>;
|
|
46
56
|
|
|
47
57
|
/** TypeScript Omit (Exclude to be specific) does not work for objects with an "any" indexed type, and breaks discriminated unions @public */
|
|
48
58
|
export type EnhancedOmit<TRecordOrUnion, KeyUnion> = string extends keyof TRecordOrUnion
|
|
@@ -56,8 +66,10 @@ export type WithoutId<TSchema> = Omit<TSchema, '_id'>;
|
|
|
56
66
|
|
|
57
67
|
/** A MongoDB filter can be some portion of the schema or a set of operators @public */
|
|
58
68
|
export type Filter<TSchema> = {
|
|
59
|
-
[
|
|
60
|
-
|
|
69
|
+
[Property in Join<NestedPaths<WithId<TSchema>>, '.'>]?: Condition<
|
|
70
|
+
PropertyType<WithId<TSchema>, Property>
|
|
71
|
+
>;
|
|
72
|
+
} & RootFilterOperators<WithId<TSchema>>;
|
|
61
73
|
|
|
62
74
|
/** @public */
|
|
63
75
|
export type Condition<T> = AlternativeType<T> | FilterOperators<AlternativeType<T>>;
|
|
@@ -90,8 +102,16 @@ export interface RootFilterOperators<TSchema> extends Document {
|
|
|
90
102
|
$comment?: string | Document;
|
|
91
103
|
}
|
|
92
104
|
|
|
105
|
+
/**
|
|
106
|
+
* @public
|
|
107
|
+
* A type that extends Document but forbids anything that "looks like" an object id.
|
|
108
|
+
*/
|
|
109
|
+
export type NonObjectIdLikeDocument = {
|
|
110
|
+
[key in keyof ObjectIdLike]?: never;
|
|
111
|
+
} & Document;
|
|
112
|
+
|
|
93
113
|
/** @public */
|
|
94
|
-
export interface FilterOperators<TValue> extends
|
|
114
|
+
export interface FilterOperators<TValue> extends NonObjectIdLikeDocument {
|
|
95
115
|
// Comparison
|
|
96
116
|
$eq?: TValue;
|
|
97
117
|
$gt?: TValue;
|
|
@@ -422,3 +442,61 @@ export class TypedEventEmitter<Events extends EventsDescription> extends EventEm
|
|
|
422
442
|
|
|
423
443
|
/** @public */
|
|
424
444
|
export class CancellationToken extends TypedEventEmitter<{ cancel(): void }> {}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Helper types for dot-notation filter attributes
|
|
448
|
+
*/
|
|
449
|
+
|
|
450
|
+
/** @public */
|
|
451
|
+
export type Join<T extends unknown[], D extends string> = T extends []
|
|
452
|
+
? ''
|
|
453
|
+
: T extends [string | number]
|
|
454
|
+
? `${T[0]}`
|
|
455
|
+
: T extends [string | number, ...infer R]
|
|
456
|
+
? `${T[0]}${D}${Join<R, D>}`
|
|
457
|
+
: string;
|
|
458
|
+
|
|
459
|
+
/** @public */
|
|
460
|
+
export type PropertyType<Type, Property extends string> = string extends Property
|
|
461
|
+
? unknown
|
|
462
|
+
: Property extends keyof Type
|
|
463
|
+
? Type[Property]
|
|
464
|
+
: Property extends `${number}`
|
|
465
|
+
? Type extends ReadonlyArray<infer ArrayType>
|
|
466
|
+
? ArrayType
|
|
467
|
+
: unknown
|
|
468
|
+
: Property extends `${infer Key}.${infer Rest}`
|
|
469
|
+
? Key extends `${number}`
|
|
470
|
+
? Type extends ReadonlyArray<infer ArrayType>
|
|
471
|
+
? PropertyType<ArrayType, Rest>
|
|
472
|
+
: unknown
|
|
473
|
+
: Key extends keyof Type
|
|
474
|
+
? Type[Key] extends Map<string, infer MapType>
|
|
475
|
+
? MapType
|
|
476
|
+
: PropertyType<Type[Key], Rest>
|
|
477
|
+
: unknown
|
|
478
|
+
: unknown;
|
|
479
|
+
|
|
480
|
+
// We dont't support nested circular references
|
|
481
|
+
/** @public */
|
|
482
|
+
export type NestedPaths<Type> = Type extends
|
|
483
|
+
| string
|
|
484
|
+
| number
|
|
485
|
+
| boolean
|
|
486
|
+
| Date
|
|
487
|
+
| RegExp
|
|
488
|
+
| Buffer
|
|
489
|
+
| Uint8Array
|
|
490
|
+
| ((...args: any[]) => any)
|
|
491
|
+
| { _bsontype: string }
|
|
492
|
+
? []
|
|
493
|
+
: Type extends ReadonlyArray<infer ArrayType>
|
|
494
|
+
? [number, ...NestedPaths<ArrayType>]
|
|
495
|
+
: Type extends Map<string, any>
|
|
496
|
+
? [string]
|
|
497
|
+
: // eslint-disable-next-line @typescript-eslint/ban-types
|
|
498
|
+
Type extends object
|
|
499
|
+
? {
|
|
500
|
+
[Key in Extract<keyof Type, string>]: [Key, ...NestedPaths<Type[Key]>];
|
|
501
|
+
}[Extract<keyof Type, string>]
|
|
502
|
+
: [];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as crypto from 'crypto';
|
|
2
|
-
|
|
3
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
4
|
-
import { MongoInvalidArgumentError } from '../error';
|
|
5
|
-
import { Callback, emitWarningOnce, getTopology } from '../utils';
|
|
2
|
+
|
|
6
3
|
import type { Document } from '../bson';
|
|
7
|
-
import type { Server } from '../sdam/server';
|
|
8
4
|
import type { Db } from '../db';
|
|
5
|
+
import { MongoInvalidArgumentError } from '../error';
|
|
6
|
+
import type { Server } from '../sdam/server';
|
|
9
7
|
import type { ClientSession } from '../sessions';
|
|
8
|
+
import { Callback, emitWarningOnce, getTopology } from '../utils';
|
|
9
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
10
|
+
import { Aspect, defineAspects } from './operation';
|
|
10
11
|
|
|
11
12
|
/** @public */
|
|
12
13
|
export interface RoleSpecification {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions, CollationOptions } from './command';
|
|
2
|
-
import { ReadPreference } from '../read_preference';
|
|
3
|
-
import { MongoInvalidArgumentError } from '../error';
|
|
4
|
-
import { maxWireVersion, MongoDBNamespace } from '../utils';
|
|
5
|
-
import { Aspect, defineAspects, Hint } from './operation';
|
|
6
|
-
import type { Callback } from '../utils';
|
|
7
1
|
import type { Document } from '../bson';
|
|
2
|
+
import { MongoInvalidArgumentError } from '../error';
|
|
8
3
|
import type { Server } from '../sdam/server';
|
|
9
4
|
import type { ClientSession } from '../sessions';
|
|
5
|
+
import type { Callback } from '../utils';
|
|
6
|
+
import { maxWireVersion, MongoDBNamespace } from '../utils';
|
|
7
|
+
import { CollationOptions, CommandOperation, CommandOperationOptions } from './command';
|
|
8
|
+
import { Aspect, defineAspects, Hint } from './operation';
|
|
10
9
|
|
|
11
10
|
/** @internal */
|
|
12
11
|
export const DB_AGGREGATE_COLLECTION = 1 as const;
|
|
@@ -65,7 +64,7 @@ export class AggregateOperation<T = Document> extends CommandOperation<T> {
|
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
if (this.hasWriteStage) {
|
|
68
|
-
this.
|
|
67
|
+
this.trySecondaryWrite = true;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
if (this.explain && this.writeConcern) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Aspect, defineAspects, AbstractOperation } from './operation';
|
|
2
|
-
import type { Callback } from '../utils';
|
|
3
|
-
import type { Collection } from '../collection';
|
|
4
1
|
import type {
|
|
2
|
+
AnyBulkWriteOperation,
|
|
5
3
|
BulkOperationBase,
|
|
6
|
-
BulkWriteResult,
|
|
7
4
|
BulkWriteOptions,
|
|
8
|
-
|
|
5
|
+
BulkWriteResult
|
|
9
6
|
} from '../bulk/common';
|
|
7
|
+
import type { Collection } from '../collection';
|
|
10
8
|
import type { Server } from '../sdam/server';
|
|
11
9
|
import type { ClientSession } from '../sessions';
|
|
10
|
+
import type { Callback } from '../utils';
|
|
11
|
+
import { AbstractOperation, Aspect, defineAspects } from './operation';
|
|
12
12
|
|
|
13
13
|
/** @internal */
|
|
14
14
|
export class BulkWriteOperation extends AbstractOperation<BulkWriteResult> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AbstractOperation, OperationOptions } from './operation';
|
|
2
1
|
import { Collection } from '../collection';
|
|
3
|
-
import type { Callback } from '../utils';
|
|
4
2
|
import type { Db } from '../db';
|
|
5
3
|
import type { Server } from '../sdam/server';
|
|
6
4
|
import type { ClientSession } from '../sessions';
|
|
5
|
+
import type { Callback } from '../utils';
|
|
6
|
+
import { AbstractOperation, OperationOptions } from './operation';
|
|
7
7
|
|
|
8
8
|
export interface CollectionsOptions extends OperationOptions {
|
|
9
9
|
nameOnly?: boolean;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BSONSerializeOptions, Document } from '../bson';
|
|
2
|
+
import { MongoCompatibilityError, MongoInvalidArgumentError } from '../error';
|
|
3
|
+
import { Explain, ExplainOptions } from '../explain';
|
|
4
|
+
import type { Logger } from '../logger';
|
|
2
5
|
import { ReadConcern } from '../read_concern';
|
|
3
|
-
import { WriteConcern, WriteConcernOptions } from '../write_concern';
|
|
4
|
-
import { maxWireVersion, MongoDBNamespace, Callback, decorateWithExplain } from '../utils';
|
|
5
6
|
import type { ReadPreference } from '../read_preference';
|
|
6
|
-
import { ClientSession, commandSupportsReadConcern } from '../sessions';
|
|
7
|
-
import { MongoInvalidArgumentError, MongoCompatibilityError } from '../error';
|
|
8
|
-
import type { Logger } from '../logger';
|
|
9
7
|
import type { Server } from '../sdam/server';
|
|
10
|
-
import
|
|
8
|
+
import { MIN_SECONDARY_WRITE_WIRE_VERSION } from '../sdam/server_selection';
|
|
9
|
+
import type { ClientSession } from '../sessions';
|
|
10
|
+
import {
|
|
11
|
+
Callback,
|
|
12
|
+
commandSupportsReadConcern,
|
|
13
|
+
decorateWithExplain,
|
|
14
|
+
maxWireVersion,
|
|
15
|
+
MongoDBNamespace
|
|
16
|
+
} from '../utils';
|
|
17
|
+
import { WriteConcern, WriteConcernOptions } from '../write_concern';
|
|
11
18
|
import type { ReadConcernLike } from './../read_concern';
|
|
12
|
-
import {
|
|
19
|
+
import { AbstractOperation, Aspect, OperationOptions } from './operation';
|
|
13
20
|
|
|
14
21
|
const SUPPORTS_WRITE_CONCERN_AND_COLLATION = 5;
|
|
15
22
|
|
|
@@ -126,6 +133,10 @@ export abstract class CommandOperation<T> extends AbstractOperation<T> {
|
|
|
126
133
|
Object.assign(cmd, { readConcern: this.readConcern });
|
|
127
134
|
}
|
|
128
135
|
|
|
136
|
+
if (this.trySecondaryWrite && serverWireVersion < MIN_SECONDARY_WRITE_WIRE_VERSION) {
|
|
137
|
+
options.omitReadPreference = true;
|
|
138
|
+
}
|
|
139
|
+
|
|
129
140
|
if (options.collation && serverWireVersion < SUPPORTS_WRITE_CONCERN_AND_COLLATION) {
|
|
130
141
|
callback(
|
|
131
142
|
new MongoCompatibilityError(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MongoTopologyClosedError } from '../error';
|
|
2
|
-
import { Callback, getTopology } from '../utils';
|
|
3
1
|
import type { Document } from '../bson';
|
|
2
|
+
import type { Collection } from '../collection';
|
|
4
3
|
import type { Db } from '../db';
|
|
5
|
-
import
|
|
4
|
+
import { MongoTopologyClosedError } from '../error';
|
|
6
5
|
import type { ReadPreference } from '../read_preference';
|
|
7
|
-
import type {
|
|
6
|
+
import type { ClientSession } from '../sessions';
|
|
7
|
+
import { Callback, getTopology } from '../utils';
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface IndexInformationOptions {
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { MongoRuntimeError, MongoInvalidArgumentError } from '../error';
|
|
2
|
-
import { Topology, TOPOLOGY_EVENTS } from '../sdam/topology';
|
|
3
1
|
import { resolveSRVRecord } from '../connection_string';
|
|
4
|
-
import
|
|
2
|
+
import { MONGO_CLIENT_EVENTS } from '../constants';
|
|
3
|
+
import { MongoInvalidArgumentError, MongoRuntimeError } from '../error';
|
|
5
4
|
import type { MongoClient, MongoOptions } from '../mongo_client';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { HEARTBEAT_EVENTS } from '../sdam/server';
|
|
9
|
-
|
|
10
|
-
/** @public */
|
|
11
|
-
export const MONGO_CLIENT_EVENTS = [
|
|
12
|
-
...CMAP_EVENTS,
|
|
13
|
-
...APM_EVENTS,
|
|
14
|
-
...TOPOLOGY_EVENTS,
|
|
15
|
-
...HEARTBEAT_EVENTS
|
|
16
|
-
] as const;
|
|
5
|
+
import { Topology } from '../sdam/topology';
|
|
6
|
+
import type { Callback } from '../utils';
|
|
17
7
|
|
|
18
8
|
export function connect(
|
|
19
9
|
mongoClient: MongoClient,
|
package/src/operations/count.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Aspect, defineAspects } from './operation';
|
|
2
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
3
|
-
import type { Callback, MongoDBNamespace } from '../utils';
|
|
4
1
|
import type { Document } from '../bson';
|
|
5
|
-
import type { Server } from '../sdam/server';
|
|
6
2
|
import type { Collection } from '../collection';
|
|
3
|
+
import type { Server } from '../sdam/server';
|
|
7
4
|
import type { ClientSession } from '../sessions';
|
|
5
|
+
import type { Callback, MongoDBNamespace } from '../utils';
|
|
6
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
7
|
+
import { Aspect, defineAspects } from './operation';
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface CountOptions extends CommandOperationOptions {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AggregateOperation, AggregateOptions } from './aggregate';
|
|
2
|
-
import type { Callback } from '../utils';
|
|
3
1
|
import type { Document } from '../bson';
|
|
4
|
-
import type { Server } from '../sdam/server';
|
|
5
2
|
import type { Collection } from '../collection';
|
|
3
|
+
import type { Server } from '../sdam/server';
|
|
6
4
|
import type { ClientSession } from '../sessions';
|
|
5
|
+
import type { Callback } from '../utils';
|
|
6
|
+
import { AggregateOperation, AggregateOptions } from './aggregate';
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export interface CountDocumentsOptions extends AggregateOptions {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
2
|
-
import { Aspect, defineAspects } from './operation';
|
|
3
|
-
import { Collection } from '../collection';
|
|
4
|
-
import type { Callback } from '../utils';
|
|
5
1
|
import type { Document } from '../bson';
|
|
6
|
-
import
|
|
2
|
+
import { Collection } from '../collection';
|
|
7
3
|
import type { Db } from '../db';
|
|
8
4
|
import type { PkFactory } from '../mongo_client';
|
|
5
|
+
import type { Server } from '../sdam/server';
|
|
9
6
|
import type { ClientSession } from '../sessions';
|
|
7
|
+
import type { Callback } from '../utils';
|
|
8
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
9
|
+
import { Aspect, defineAspects } from './operation';
|
|
10
10
|
|
|
11
11
|
const ILLEGAL_COMMAND_FIELDS = new Set([
|
|
12
12
|
'w',
|
|
@@ -27,7 +27,8 @@ const ILLEGAL_COMMAND_FIELDS = new Set([
|
|
|
27
27
|
'promoteBuffers',
|
|
28
28
|
'bsonRegExp',
|
|
29
29
|
'serializeFunctions',
|
|
30
|
-
'ignoreUndefined'
|
|
30
|
+
'ignoreUndefined',
|
|
31
|
+
'enableUtf8Validation'
|
|
31
32
|
]);
|
|
32
33
|
|
|
33
34
|
/** @public
|
|
@@ -37,7 +38,7 @@ const ILLEGAL_COMMAND_FIELDS = new Set([
|
|
|
37
38
|
export interface TimeSeriesCollectionOptions extends Document {
|
|
38
39
|
timeField: string;
|
|
39
40
|
metaField?: string;
|
|
40
|
-
granularity?: string;
|
|
41
|
+
granularity?: 'seconds' | 'minutes' | 'hours' | string;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/** @public */
|
package/src/operations/delete.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineAspects, Aspect, Hint } from './operation';
|
|
2
|
-
import { CommandOperation, CommandOperationOptions, CollationOptions } from './command';
|
|
3
|
-
import { Callback, maxWireVersion, MongoDBNamespace, collationNotSupported } from '../utils';
|
|
4
1
|
import type { Document } from '../bson';
|
|
5
|
-
import type { Server } from '../sdam/server';
|
|
6
2
|
import type { Collection } from '../collection';
|
|
3
|
+
import { MongoCompatibilityError, MongoServerError } from '../error';
|
|
4
|
+
import type { Server } from '../sdam/server';
|
|
7
5
|
import type { ClientSession } from '../sessions';
|
|
8
|
-
import {
|
|
6
|
+
import { Callback, collationNotSupported, maxWireVersion, MongoDBNamespace } from '../utils';
|
|
9
7
|
import type { WriteConcernOptions } from '../write_concern';
|
|
8
|
+
import { CollationOptions, CommandOperation, CommandOperationOptions } from './command';
|
|
9
|
+
import { Aspect, defineAspects, Hint } from './operation';
|
|
10
10
|
|
|
11
11
|
/** @public */
|
|
12
12
|
export interface DeleteOptions extends CommandOperationOptions, WriteConcernOptions {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Aspect, defineAspects } from './operation';
|
|
2
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
3
|
-
import { decorateWithCollation, decorateWithReadConcern, Callback, maxWireVersion } from '../utils';
|
|
4
1
|
import type { Document } from '../bson';
|
|
5
|
-
import type { Server } from '../sdam/server';
|
|
6
2
|
import type { Collection } from '../collection';
|
|
7
3
|
import { MongoCompatibilityError } from '../error';
|
|
4
|
+
import type { Server } from '../sdam/server';
|
|
8
5
|
import type { ClientSession } from '../sessions';
|
|
6
|
+
import { Callback, decorateWithCollation, decorateWithReadConcern, maxWireVersion } from '../utils';
|
|
7
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
8
|
+
import { Aspect, defineAspects } from './operation';
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
11
|
export type DistinctOptions = CommandOperationOptions;
|
package/src/operations/drop.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Aspect, defineAspects } from './operation';
|
|
2
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
3
|
-
import type { Callback } from '../utils';
|
|
4
|
-
import type { Server } from '../sdam/server';
|
|
5
1
|
import type { Db } from '../db';
|
|
2
|
+
import type { Server } from '../sdam/server';
|
|
6
3
|
import type { ClientSession } from '../sessions';
|
|
4
|
+
import type { Callback } from '../utils';
|
|
5
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
6
|
+
import { Aspect, defineAspects } from './operation';
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export type DropCollectionOptions = CommandOperationOptions;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Aspect, defineAspects } from './operation';
|
|
2
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
3
|
-
import { Callback, maxWireVersion } from '../utils';
|
|
4
1
|
import type { Document } from '../bson';
|
|
5
|
-
import type { Server } from '../sdam/server';
|
|
6
2
|
import type { Collection } from '../collection';
|
|
7
|
-
import type { ClientSession } from '../sessions';
|
|
8
3
|
import type { MongoServerError } from '../error';
|
|
4
|
+
import type { Server } from '../sdam/server';
|
|
5
|
+
import type { ClientSession } from '../sessions';
|
|
6
|
+
import { Callback, maxWireVersion } from '../utils';
|
|
7
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
8
|
+
import { Aspect, defineAspects } from './operation';
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
11
|
export interface EstimatedDocumentCountOptions extends CommandOperationOptions {
|
package/src/operations/eval.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
2
1
|
import { Code, Document } from '../bson';
|
|
3
|
-
import {
|
|
2
|
+
import type { Collection } from '../collection';
|
|
3
|
+
import type { Db } from '../db';
|
|
4
4
|
import { MongoServerError } from '../error';
|
|
5
|
-
import
|
|
5
|
+
import { ReadPreference } from '../read_preference';
|
|
6
6
|
import type { Server } from '../sdam/server';
|
|
7
|
-
import type { Db } from '../db';
|
|
8
|
-
import type { Collection } from '../collection';
|
|
9
7
|
import type { ClientSession } from '../sessions';
|
|
8
|
+
import type { Callback } from '../utils';
|
|
9
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
10
10
|
|
|
11
11
|
/** @public */
|
|
12
12
|
export interface EvalOptions extends CommandOperationOptions {
|