mongodb 4.2.2 → 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 +1 -1
- 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 -3
- 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 -6
- 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 +14 -8
- 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 +1 -1
- package/lib/cmap/stream_description.js.map +1 -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 -19
- 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 +5 -5
- 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/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 +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 +5 -6
- 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.map +1 -1
- 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 +1 -1
- 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 +11 -4
- 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 +24 -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 +2 -2
- 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 +25 -55
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +2 -2
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +12 -27
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js +1 -1
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +40 -9
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +105 -32
- package/mongodb.ts34.d.ts +129 -32
- package/package.json +7 -3
- package/src/admin.ts +9 -9
- package/src/bson.ts +25 -17
- package/src/bulk/common.ts +17 -17
- package/src/bulk/ordered.ts +4 -4
- package/src/bulk/unordered.ts +5 -5
- package/src/change_stream.ts +25 -24
- 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 +22 -14
- package/src/cmap/connect.ts +142 -22
- package/src/cmap/connection.ts +72 -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 +2 -2
- package/src/cmap/wire_protocol/compression.ts +2 -2
- package/src/cmap/wire_protocol/shared.ts +10 -9
- package/src/collection.ts +94 -82
- package/src/connection_string.ts +66 -24
- package/src/constants.ts +116 -0
- package/src/cursor/abstract_cursor.ts +14 -13
- 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 +1 -1
- 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 +97 -19
- package/src/operations/add_user.ts +6 -5
- 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 +10 -11
- package/src/operations/find.ts +14 -14
- package/src/operations/find_and_modify.ts +7 -7
- package/src/operations/get_more.ts +2 -2
- 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 +3 -3
- 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 +14 -6
- 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 +63 -61
- package/src/sdam/server_description.ts +4 -4
- package/src/sdam/server_selection.ts +3 -3
- package/src/sdam/srv_polling.ts +3 -2
- package/src/sdam/topology.ts +63 -81
- package/src/sdam/topology_description.ts +4 -4
- package/src/sessions.ts +30 -48
- package/src/transactions.ts +4 -4
- package/src/utils.ts +58 -22
- 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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ReadPreference } from '../read_preference';
|
|
2
|
-
import { maxWireVersion, decorateWithCollation, hasAtomicOperators, Callback } from '../utils';
|
|
3
|
-
import { MongoInvalidArgumentError, MongoCompatibilityError } from '../error';
|
|
4
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
5
|
-
import { defineAspects, Aspect } from './operation';
|
|
6
1
|
import type { Document } from '../bson';
|
|
7
|
-
import type { Server } from '../sdam/server';
|
|
8
2
|
import type { Collection } from '../collection';
|
|
9
|
-
import {
|
|
3
|
+
import { MongoCompatibilityError, MongoInvalidArgumentError } from '../error';
|
|
4
|
+
import { ReadPreference } from '../read_preference';
|
|
5
|
+
import type { Server } from '../sdam/server';
|
|
10
6
|
import type { ClientSession } from '../sessions';
|
|
7
|
+
import { formatSort, Sort, SortForCmd } from '../sort';
|
|
8
|
+
import { Callback, decorateWithCollation, hasAtomicOperators, maxWireVersion } from '../utils';
|
|
11
9
|
import type { WriteConcern, WriteConcernSettings } from '../write_concern';
|
|
10
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
11
|
+
import { Aspect, defineAspects } from './operation';
|
|
12
12
|
|
|
13
13
|
/** @public */
|
|
14
14
|
export const ReturnDocument = Object.freeze({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Document, Long } from '../bson';
|
|
2
2
|
import { MongoRuntimeError } from '../error';
|
|
3
|
-
import type { Callback, MongoDBNamespace } from '../utils';
|
|
4
3
|
import type { Server } from '../sdam/server';
|
|
5
|
-
import { Aspect, AbstractOperation, OperationOptions, defineAspects } from './operation';
|
|
6
4
|
import type { ClientSession } from '../sessions';
|
|
5
|
+
import type { Callback, MongoDBNamespace } from '../utils';
|
|
6
|
+
import { AbstractOperation, Aspect, defineAspects, OperationOptions } from './operation';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @public
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Document } from '../bson';
|
|
2
|
+
import type { Collection } from '../collection';
|
|
3
|
+
import { AbstractCursor } from '../cursor/abstract_cursor';
|
|
4
|
+
import type { Db } from '../db';
|
|
5
|
+
import { MongoCompatibilityError, MONGODB_ERROR_CODES, MongoServerError } from '../error';
|
|
6
|
+
import type { OneOrMore } from '../mongo_types';
|
|
7
|
+
import { ReadPreference } from '../read_preference';
|
|
8
|
+
import type { Server } from '../sdam/server';
|
|
9
|
+
import type { ClientSession } from '../sessions';
|
|
4
10
|
import {
|
|
11
|
+
Callback,
|
|
12
|
+
getTopology,
|
|
5
13
|
maxWireVersion,
|
|
6
|
-
parseIndexOptions,
|
|
7
14
|
MongoDBNamespace,
|
|
8
|
-
|
|
9
|
-
getTopology
|
|
15
|
+
parseIndexOptions
|
|
10
16
|
} from '../utils';
|
|
11
17
|
import {
|
|
18
|
+
CollationOptions,
|
|
12
19
|
CommandOperation,
|
|
13
20
|
CommandOperationOptions,
|
|
14
|
-
OperationParent
|
|
15
|
-
CollationOptions
|
|
21
|
+
OperationParent
|
|
16
22
|
} from './command';
|
|
17
|
-
import {
|
|
18
|
-
import type { Server } from '../sdam/server';
|
|
19
|
-
import type { Document } from '../bson';
|
|
20
|
-
import type { Collection } from '../collection';
|
|
21
|
-
import type { Db } from '../db';
|
|
22
|
-
import { AbstractCursor } from '../cursor/abstract_cursor';
|
|
23
|
-
import type { ClientSession } from '../sessions';
|
|
23
|
+
import { indexInformation, IndexInformationOptions } from './common_functions';
|
|
24
24
|
import { executeOperation, ExecutionResult } from './execute_operation';
|
|
25
|
-
import
|
|
25
|
+
import { AbstractOperation, Aspect, defineAspects } from './operation';
|
|
26
26
|
|
|
27
27
|
const LIST_INDEXES_WIRE_VERSION = 3;
|
|
28
28
|
const VALID_INDEX_OPTIONS = new Set([
|
package/src/operations/insert.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { MongoServerError, MongoInvalidArgumentError } from '../error';
|
|
2
|
-
import { defineAspects, Aspect, AbstractOperation } from './operation';
|
|
3
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
4
|
-
import { prepareDocs } from './common_functions';
|
|
5
|
-
import type { Callback, MongoDBNamespace } from '../utils';
|
|
6
|
-
import type { Server } from '../sdam/server';
|
|
7
|
-
import type { Collection } from '../collection';
|
|
8
1
|
import type { Document } from '../bson';
|
|
9
2
|
import type { BulkWriteOptions } from '../bulk/common';
|
|
10
|
-
import {
|
|
3
|
+
import type { Collection } from '../collection';
|
|
4
|
+
import { MongoInvalidArgumentError, MongoServerError } from '../error';
|
|
5
|
+
import type { InferIdType } from '../mongo_types';
|
|
6
|
+
import type { Server } from '../sdam/server';
|
|
11
7
|
import type { ClientSession } from '../sessions';
|
|
8
|
+
import type { Callback, MongoDBNamespace } from '../utils';
|
|
9
|
+
import { WriteConcern } from '../write_concern';
|
|
12
10
|
import { BulkWriteOperation } from './bulk_write';
|
|
13
|
-
import
|
|
11
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
12
|
+
import { prepareDocs } from './common_functions';
|
|
13
|
+
import { AbstractOperation, Aspect, defineAspects } from './operation';
|
|
14
14
|
|
|
15
15
|
/** @internal */
|
|
16
16
|
export class InsertOperation extends CommandOperation<Document> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Callback } from '../utils';
|
|
2
1
|
import type { Collection } from '../collection';
|
|
3
|
-
import {
|
|
2
|
+
import { MongoAPIError } from '../error';
|
|
4
3
|
import type { Server } from '../sdam/server';
|
|
5
4
|
import type { ClientSession } from '../sessions';
|
|
6
|
-
import {
|
|
5
|
+
import type { Callback } from '../utils';
|
|
6
|
+
import { AbstractOperation, OperationOptions } from './operation';
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
9
9
|
export class IsCappedOperation extends AbstractOperation<boolean> {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
2
|
-
import { Aspect, defineAspects } from './operation';
|
|
3
|
-
import { maxWireVersion, Callback, getTopology, MongoDBNamespace } from '../utils';
|
|
4
|
-
import * as CONSTANTS from '../constants';
|
|
5
1
|
import type { Binary, Document } from '../bson';
|
|
6
|
-
import
|
|
7
|
-
import type { Db } from '../db';
|
|
2
|
+
import * as CONSTANTS from '../constants';
|
|
8
3
|
import { AbstractCursor } from '../cursor/abstract_cursor';
|
|
4
|
+
import type { Db } from '../db';
|
|
5
|
+
import type { Server } from '../sdam/server';
|
|
9
6
|
import type { ClientSession } from '../sessions';
|
|
7
|
+
import { Callback, getTopology, maxWireVersion, MongoDBNamespace } from '../utils';
|
|
8
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
10
9
|
import { executeOperation, ExecutionResult } from './execute_operation';
|
|
10
|
+
import { Aspect, defineAspects } from './operation';
|
|
11
11
|
|
|
12
12
|
const LIST_COLLECTIONS_WIRE_VERSION = 3;
|
|
13
13
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
2
|
-
import { Aspect, defineAspects } from './operation';
|
|
3
|
-
import { MongoDBNamespace, Callback } from '../utils';
|
|
4
1
|
import type { Document } from '../bson';
|
|
5
|
-
import type { Server } from '../sdam/server';
|
|
6
2
|
import type { Db } from '../db';
|
|
3
|
+
import type { Server } from '../sdam/server';
|
|
7
4
|
import type { ClientSession } from '../sessions';
|
|
5
|
+
import { 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 ListDatabasesResult {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import type { ObjectId } from '../bson';
|
|
1
2
|
import { Code, Document } from '../bson';
|
|
3
|
+
import type { Collection } from '../collection';
|
|
4
|
+
import { Db } from '../db';
|
|
5
|
+
import { MongoCompatibilityError, MongoServerError } from '../error';
|
|
6
|
+
import { ReadPreference, ReadPreferenceMode } from '../read_preference';
|
|
7
|
+
import type { Server } from '../sdam/server';
|
|
8
|
+
import type { ClientSession } from '../sessions';
|
|
9
|
+
import type { Sort } from '../sort';
|
|
2
10
|
import {
|
|
3
11
|
applyWriteConcern,
|
|
12
|
+
Callback,
|
|
4
13
|
decorateWithCollation,
|
|
5
14
|
decorateWithReadConcern,
|
|
6
15
|
isObject,
|
|
7
|
-
Callback,
|
|
8
16
|
maxWireVersion
|
|
9
17
|
} from '../utils';
|
|
10
|
-
import { ReadPreference, ReadPreferenceMode } from '../read_preference';
|
|
11
18
|
import { CommandOperation, CommandOperationOptions } from './command';
|
|
12
|
-
import type { Server } from '../sdam/server';
|
|
13
|
-
import type { Collection } from '../collection';
|
|
14
|
-
import type { Sort } from '../sort';
|
|
15
|
-
import { MongoServerError, MongoCompatibilityError } from '../error';
|
|
16
|
-
import type { ObjectId } from '../bson';
|
|
17
19
|
import { Aspect, defineAspects } from './operation';
|
|
18
|
-
import type { ClientSession } from '../sessions';
|
|
19
|
-
import { Db } from '../db';
|
|
20
20
|
|
|
21
21
|
const exclusionList = [
|
|
22
22
|
'explain',
|
|
@@ -33,6 +33,7 @@ const exclusionList = [
|
|
|
33
33
|
'bsonRegExp',
|
|
34
34
|
'serializeFunctions',
|
|
35
35
|
'ignoreUndefined',
|
|
36
|
+
'enableUtf8Validation',
|
|
36
37
|
'scope' // this option is reformatted thus exclude the original
|
|
37
38
|
];
|
|
38
39
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { BSONSerializeOptions, Document, resolveBSONOptions } from '../bson';
|
|
1
2
|
import { ReadPreference, ReadPreferenceLike } from '../read_preference';
|
|
2
|
-
import type { ClientSession } from '../sessions';
|
|
3
|
-
import { Document, BSONSerializeOptions, resolveBSONOptions } from '../bson';
|
|
4
|
-
import type { MongoDBNamespace, Callback } from '../utils';
|
|
5
3
|
import type { Server } from '../sdam/server';
|
|
4
|
+
import type { ClientSession } from '../sessions';
|
|
5
|
+
import type { Callback, MongoDBNamespace } from '../utils';
|
|
6
6
|
|
|
7
7
|
export const Aspect = {
|
|
8
8
|
READ_OPERATION: Symbol('READ_OPERATION'),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AbstractOperation, OperationOptions } from './operation';
|
|
2
|
-
import { MongoAPIError } from '../error';
|
|
3
|
-
import type { Callback } from '../utils';
|
|
4
1
|
import type { Document } from '../bson';
|
|
5
2
|
import type { Collection } from '../collection';
|
|
3
|
+
import { MongoAPIError } from '../error';
|
|
6
4
|
import type { Server } from '../sdam/server';
|
|
7
5
|
import type { ClientSession } from '../sessions';
|
|
6
|
+
import type { Callback } from '../utils';
|
|
7
|
+
import { AbstractOperation, OperationOptions } from './operation';
|
|
8
8
|
|
|
9
9
|
/** @internal */
|
|
10
10
|
export class OptionsOperation extends AbstractOperation<Document> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
2
|
-
import type { Callback } from '../utils';
|
|
3
|
-
import type { Server } from '../sdam/server';
|
|
4
1
|
import type { Db } from '../db';
|
|
5
|
-
import type { ClientSession } from '../sessions';
|
|
6
2
|
import { MongoRuntimeError } from '../error';
|
|
3
|
+
import type { Server } from '../sdam/server';
|
|
4
|
+
import type { ClientSession } from '../sessions';
|
|
5
|
+
import type { Callback } from '../utils';
|
|
6
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export type ProfilingLevelOptions = CommandOperationOptions;
|
|
@@ -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 RemoveUserOptions = CommandOperationOptions;
|
package/src/operations/rename.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RunAdminCommandOperation } from './run_command';
|
|
3
|
-
import { defineAspects, Aspect } from './operation';
|
|
4
|
-
import type { Server } from '../sdam/server';
|
|
1
|
+
import type { Document } from '../bson';
|
|
5
2
|
import { Collection } from '../collection';
|
|
6
|
-
import type { CommandOperationOptions } from './command';
|
|
7
3
|
import { MongoServerError } from '../error';
|
|
4
|
+
import type { Server } from '../sdam/server';
|
|
8
5
|
import type { ClientSession } from '../sessions';
|
|
9
|
-
import
|
|
6
|
+
import { Callback, checkCollectionName } from '../utils';
|
|
7
|
+
import type { CommandOperationOptions } from './command';
|
|
8
|
+
import { Aspect, defineAspects } from './operation';
|
|
9
|
+
import { RunAdminCommandOperation } from './run_command';
|
|
10
10
|
|
|
11
11
|
/** @public */
|
|
12
12
|
export interface RenameOptions extends CommandOperationOptions {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions, OperationParent } from './command';
|
|
2
|
-
import { MongoDBNamespace, Callback } from '../utils';
|
|
3
|
-
import type { Server } from '../sdam/server';
|
|
4
1
|
import type { Document } from '../bson';
|
|
2
|
+
import type { Server } from '../sdam/server';
|
|
5
3
|
import type { ClientSession } from '../sessions';
|
|
4
|
+
import { Callback, MongoDBNamespace } from '../utils';
|
|
5
|
+
import { CommandOperation, CommandOperationOptions, OperationParent } from './command';
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export type RunCommandOptions = CommandOperationOptions;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
2
|
-
import type { Callback } from '../utils';
|
|
3
|
-
import { enumToString } from '../utils';
|
|
4
|
-
import type { Server } from '../sdam/server';
|
|
5
1
|
import type { Db } from '../db';
|
|
2
|
+
import { MongoInvalidArgumentError, MongoRuntimeError } from '../error';
|
|
3
|
+
import type { Server } from '../sdam/server';
|
|
6
4
|
import type { ClientSession } from '../sessions';
|
|
7
|
-
import {
|
|
5
|
+
import type { Callback } from '../utils';
|
|
6
|
+
import { enumToString } from '../utils';
|
|
7
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
8
|
+
|
|
8
9
|
const levelValues = new Set(['off', 'slow_only', 'all']);
|
|
9
10
|
|
|
10
11
|
/** @public */
|
package/src/operations/stats.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Aspect, defineAspects } from './operation';
|
|
2
|
-
import { CommandOperation, CommandOperationOptions } from './command';
|
|
3
|
-
import type { Callback } 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 type { Db } from '../db';
|
|
4
|
+
import type { Server } from '../sdam/server';
|
|
8
5
|
import type { ClientSession } from '../sessions';
|
|
6
|
+
import type { Callback } from '../utils';
|
|
7
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
8
|
+
import { Aspect, defineAspects } from './operation';
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
11
|
export interface CollStatsOptions extends CommandOperationOptions {
|
package/src/operations/update.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Document, ObjectId } from '../bson';
|
|
2
|
+
import type { Collection } from '../collection';
|
|
3
|
+
import { MongoCompatibilityError, MongoInvalidArgumentError, MongoServerError } from '../error';
|
|
4
|
+
import type { Server } from '../sdam/server';
|
|
5
|
+
import type { ClientSession } from '../sessions';
|
|
2
6
|
import {
|
|
3
|
-
hasAtomicOperators,
|
|
4
|
-
MongoDBNamespace,
|
|
5
7
|
Callback,
|
|
6
8
|
collationNotSupported,
|
|
7
|
-
|
|
9
|
+
hasAtomicOperators,
|
|
10
|
+
maxWireVersion,
|
|
11
|
+
MongoDBNamespace
|
|
8
12
|
} from '../utils';
|
|
9
|
-
import { CommandOperation, CommandOperationOptions
|
|
10
|
-
import
|
|
11
|
-
import type { Collection } from '../collection';
|
|
12
|
-
import type { ObjectId, Document } from '../bson';
|
|
13
|
-
import type { ClientSession } from '../sessions';
|
|
14
|
-
import { MongoServerError, MongoInvalidArgumentError, MongoCompatibilityError } from '../error';
|
|
13
|
+
import { CollationOptions, CommandOperation, CommandOperationOptions } from './command';
|
|
14
|
+
import { Aspect, defineAspects, Hint } from './operation';
|
|
15
15
|
|
|
16
16
|
/** @public */
|
|
17
17
|
export interface UpdateOptions extends CommandOperationOptions {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Callback } from '../utils';
|
|
1
|
+
import type { Admin } from '../admin';
|
|
3
2
|
import type { Document } from '../bson';
|
|
3
|
+
import { MongoRuntimeError } from '../error';
|
|
4
4
|
import type { Server } from '../sdam/server';
|
|
5
|
-
import type { Admin } from '../admin';
|
|
6
5
|
import type { ClientSession } from '../sessions';
|
|
7
|
-
import {
|
|
6
|
+
import type { Callback } from '../utils';
|
|
7
|
+
import { CommandOperation, CommandOperationOptions } from './command';
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface ValidateCollectionOptions extends CommandOperationOptions {
|
package/src/read_preference.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TagSet } from './sdam/server_description';
|
|
2
1
|
import type { Document } from './bson';
|
|
3
|
-
import type { ClientSession } from './sessions';
|
|
4
2
|
import { MongoInvalidArgumentError } from './error';
|
|
3
|
+
import type { TagSet } from './sdam/server_description';
|
|
4
|
+
import type { ClientSession } from './sessions';
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export type ReadPreferenceLike = ReadPreference | ReadPreferenceMode;
|
|
@@ -232,19 +232,27 @@ export class ReadPreference {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
|
-
* Indicates that this readPreference needs the "
|
|
236
|
-
*
|
|
235
|
+
* Indicates that this readPreference needs the "secondaryOk" bit when sent over the wire
|
|
236
|
+
* @deprecated Use secondaryOk instead
|
|
237
237
|
* @see https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-query
|
|
238
238
|
*/
|
|
239
239
|
slaveOk(): boolean {
|
|
240
|
-
|
|
240
|
+
return this.secondaryOk();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Indicates that this readPreference needs the "SecondaryOk" bit when sent over the wire
|
|
245
|
+
* @see https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op-query
|
|
246
|
+
*/
|
|
247
|
+
secondaryOk(): boolean {
|
|
248
|
+
const NEEDS_SECONDARYOK = new Set<string>([
|
|
241
249
|
ReadPreference.PRIMARY_PREFERRED,
|
|
242
250
|
ReadPreference.SECONDARY,
|
|
243
251
|
ReadPreference.SECONDARY_PREFERRED,
|
|
244
252
|
ReadPreference.NEAREST
|
|
245
253
|
]);
|
|
246
254
|
|
|
247
|
-
return
|
|
255
|
+
return NEEDS_SECONDARYOK.has(this.mode);
|
|
248
256
|
}
|
|
249
257
|
|
|
250
258
|
/**
|
package/src/sdam/common.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Topology } from './topology';
|
|
1
|
+
import type { Binary, Long, Timestamp } from '../bson';
|
|
3
2
|
import type { ClientSession } from '../sessions';
|
|
3
|
+
import type { Topology } from './topology';
|
|
4
4
|
|
|
5
5
|
// shared state names
|
|
6
6
|
export const STATE_CLOSING = 'closing';
|
package/src/sdam/events.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Document } from '../bson';
|
|
1
2
|
import type { ServerDescription } from './server_description';
|
|
2
3
|
import type { TopologyDescription } from './topology_description';
|
|
3
|
-
import type { Document } from '../bson';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Emitted when server description changes, but does NOT include changes to the RTT.
|
package/src/sdam/monitor.ts
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Document, Long } from '../bson';
|
|
2
|
+
import { connect } from '../cmap/connect';
|
|
3
|
+
import { Connection, ConnectionOptions } from '../cmap/connection';
|
|
4
|
+
import { AnyError, MongoNetworkError } from '../error';
|
|
5
|
+
import { CancellationToken, TypedEventEmitter } from '../mongo_types';
|
|
6
|
+
import type { Callback, InterruptibleAsyncInterval } from '../utils';
|
|
2
7
|
import {
|
|
3
|
-
now,
|
|
4
|
-
makeStateMachine,
|
|
5
8
|
calculateDurationInMs,
|
|
9
|
+
EventEmitterWithState,
|
|
6
10
|
makeInterruptibleAsyncInterval,
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
makeStateMachine,
|
|
12
|
+
now,
|
|
13
|
+
ns
|
|
9
14
|
} from '../utils';
|
|
10
|
-
import {
|
|
11
|
-
import { Connection, ConnectionOptions } from '../cmap/connection';
|
|
12
|
-
import { MongoNetworkError, AnyError } from '../error';
|
|
13
|
-
import { Long, Document } from '../bson';
|
|
15
|
+
import { ServerType, STATE_CLOSED, STATE_CLOSING } from './common';
|
|
14
16
|
import {
|
|
17
|
+
ServerHeartbeatFailedEvent,
|
|
15
18
|
ServerHeartbeatStartedEvent,
|
|
16
|
-
ServerHeartbeatSucceededEvent
|
|
17
|
-
ServerHeartbeatFailedEvent
|
|
19
|
+
ServerHeartbeatSucceededEvent
|
|
18
20
|
} from './events';
|
|
19
|
-
|
|
20
21
|
import { Server } from './server';
|
|
21
|
-
import type { InterruptibleAsyncInterval, Callback } from '../utils';
|
|
22
22
|
import type { TopologyVersion } from './server_description';
|
|
23
|
-
import { CancellationToken, TypedEventEmitter } from '../mongo_types';
|
|
24
23
|
|
|
25
24
|
/** @internal */
|
|
26
25
|
const kServer = Symbol('server');
|
package/src/sdam/server.ts
CHANGED
|
@@ -1,62 +1,72 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Document, Long } from '../bson';
|
|
2
|
+
import {
|
|
3
|
+
CommandOptions,
|
|
4
|
+
Connection,
|
|
5
|
+
DestroyOptions,
|
|
6
|
+
GetMoreOptions,
|
|
7
|
+
QueryOptions
|
|
8
|
+
} from '../cmap/connection';
|
|
2
9
|
import {
|
|
3
10
|
ConnectionPool,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
ConnectionPoolEvents
|
|
11
|
+
ConnectionPoolEvents,
|
|
12
|
+
ConnectionPoolOptions
|
|
7
13
|
} from '../cmap/connection_pool';
|
|
8
|
-
import {
|
|
9
|
-
|
|
14
|
+
import {
|
|
15
|
+
APM_EVENTS,
|
|
16
|
+
CLOSED,
|
|
17
|
+
CMAP_EVENTS,
|
|
18
|
+
CONNECT,
|
|
19
|
+
DESCRIPTION_RECEIVED,
|
|
20
|
+
ENDED,
|
|
21
|
+
HEARTBEAT_EVENTS,
|
|
22
|
+
SERVER_HEARTBEAT_FAILED,
|
|
23
|
+
SERVER_HEARTBEAT_STARTED,
|
|
24
|
+
SERVER_HEARTBEAT_SUCCEEDED
|
|
25
|
+
} from '../constants';
|
|
26
|
+
import type { AutoEncrypter } from '../deps';
|
|
27
|
+
import {
|
|
28
|
+
isNetworkErrorBeforeHandshake,
|
|
29
|
+
isNodeShuttingDownError,
|
|
30
|
+
isRetryableWriteError,
|
|
31
|
+
isSDAMUnrecoverableError,
|
|
32
|
+
MongoCompatibilityError,
|
|
33
|
+
MongoError,
|
|
34
|
+
MongoInvalidArgumentError,
|
|
35
|
+
MongoNetworkError,
|
|
36
|
+
MongoNetworkTimeoutError,
|
|
37
|
+
MongoServerClosedError
|
|
38
|
+
} from '../error';
|
|
39
|
+
import { Logger } from '../logger';
|
|
40
|
+
import type { ServerApi } from '../mongo_client';
|
|
41
|
+
import { TypedEventEmitter } from '../mongo_types';
|
|
42
|
+
import type { ClientSession } from '../sessions';
|
|
10
43
|
import { isTransactionCommand } from '../transactions';
|
|
11
44
|
import {
|
|
45
|
+
Callback,
|
|
46
|
+
CallbackWithType,
|
|
12
47
|
collationNotSupported,
|
|
48
|
+
EventEmitterWithState,
|
|
13
49
|
makeStateMachine,
|
|
14
50
|
maxWireVersion,
|
|
15
|
-
Callback,
|
|
16
|
-
CallbackWithType,
|
|
17
51
|
MongoDBNamespace,
|
|
18
|
-
|
|
52
|
+
supportsRetryableWrites
|
|
19
53
|
} from '../utils';
|
|
20
54
|
import {
|
|
55
|
+
ClusterTime,
|
|
21
56
|
STATE_CLOSED,
|
|
22
57
|
STATE_CLOSING,
|
|
23
|
-
STATE_CONNECTING,
|
|
24
58
|
STATE_CONNECTED,
|
|
25
|
-
|
|
59
|
+
STATE_CONNECTING,
|
|
26
60
|
TopologyType
|
|
27
61
|
} from './common';
|
|
28
|
-
import {
|
|
29
|
-
MongoError,
|
|
30
|
-
MongoNetworkError,
|
|
31
|
-
MongoNetworkTimeoutError,
|
|
32
|
-
isSDAMUnrecoverableError,
|
|
33
|
-
isRetryableWriteError,
|
|
34
|
-
isNodeShuttingDownError,
|
|
35
|
-
isNetworkErrorBeforeHandshake,
|
|
36
|
-
MongoCompatibilityError,
|
|
37
|
-
MongoInvalidArgumentError,
|
|
38
|
-
MongoServerClosedError
|
|
39
|
-
} from '../error';
|
|
40
|
-
import {
|
|
41
|
-
Connection,
|
|
42
|
-
DestroyOptions,
|
|
43
|
-
QueryOptions,
|
|
44
|
-
GetMoreOptions,
|
|
45
|
-
CommandOptions,
|
|
46
|
-
APM_EVENTS
|
|
47
|
-
} from '../cmap/connection';
|
|
48
|
-
import type { Topology } from './topology';
|
|
49
62
|
import type {
|
|
50
63
|
ServerHeartbeatFailedEvent,
|
|
51
64
|
ServerHeartbeatStartedEvent,
|
|
52
65
|
ServerHeartbeatSucceededEvent
|
|
53
66
|
} from './events';
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import type {
|
|
57
|
-
import type { ServerApi } from '../mongo_client';
|
|
58
|
-
import { TypedEventEmitter } from '../mongo_types';
|
|
59
|
-
import { supportsRetryableWrites } from '../utils';
|
|
67
|
+
import { Monitor, MonitorOptions } from './monitor';
|
|
68
|
+
import { compareTopologyVersion, ServerDescription } from './server_description';
|
|
69
|
+
import type { Topology } from './topology';
|
|
60
70
|
|
|
61
71
|
const stateTransition = makeStateMachine({
|
|
62
72
|
[STATE_CLOSED]: [STATE_CLOSED, STATE_CONNECTING],
|
|
@@ -108,24 +118,23 @@ export class Server extends TypedEventEmitter<ServerEvents> {
|
|
|
108
118
|
/** @internal */
|
|
109
119
|
s: ServerPrivate;
|
|
110
120
|
serverApi?: ServerApi;
|
|
111
|
-
clusterTime?: ClusterTime;
|
|
112
121
|
ismaster?: Document;
|
|
113
122
|
[kMonitor]: Monitor;
|
|
114
123
|
|
|
115
124
|
/** @event */
|
|
116
|
-
static readonly SERVER_HEARTBEAT_STARTED =
|
|
125
|
+
static readonly SERVER_HEARTBEAT_STARTED = SERVER_HEARTBEAT_STARTED;
|
|
117
126
|
/** @event */
|
|
118
|
-
static readonly SERVER_HEARTBEAT_SUCCEEDED =
|
|
127
|
+
static readonly SERVER_HEARTBEAT_SUCCEEDED = SERVER_HEARTBEAT_SUCCEEDED;
|
|
119
128
|
/** @event */
|
|
120
|
-
static readonly SERVER_HEARTBEAT_FAILED =
|
|
129
|
+
static readonly SERVER_HEARTBEAT_FAILED = SERVER_HEARTBEAT_FAILED;
|
|
121
130
|
/** @event */
|
|
122
|
-
static readonly CONNECT =
|
|
131
|
+
static readonly CONNECT = CONNECT;
|
|
123
132
|
/** @event */
|
|
124
|
-
static readonly DESCRIPTION_RECEIVED =
|
|
133
|
+
static readonly DESCRIPTION_RECEIVED = DESCRIPTION_RECEIVED;
|
|
125
134
|
/** @event */
|
|
126
|
-
static readonly CLOSED =
|
|
135
|
+
static readonly CLOSED = CLOSED;
|
|
127
136
|
/** @event */
|
|
128
|
-
static readonly ENDED =
|
|
137
|
+
static readonly ENDED = ENDED;
|
|
129
138
|
|
|
130
139
|
/**
|
|
131
140
|
* Create a server
|
|
@@ -184,6 +193,14 @@ export class Server extends TypedEventEmitter<ServerEvents> {
|
|
|
184
193
|
});
|
|
185
194
|
}
|
|
186
195
|
|
|
196
|
+
get clusterTime(): ClusterTime | undefined {
|
|
197
|
+
return this.s.topology.clusterTime;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
set clusterTime(clusterTime: ClusterTime | undefined) {
|
|
201
|
+
this.s.topology.clusterTime = clusterTime;
|
|
202
|
+
}
|
|
203
|
+
|
|
187
204
|
get description(): ServerDescription {
|
|
188
205
|
return this.s.description;
|
|
189
206
|
}
|
|
@@ -453,21 +470,6 @@ export class Server extends TypedEventEmitter<ServerEvents> {
|
|
|
453
470
|
}
|
|
454
471
|
}
|
|
455
472
|
|
|
456
|
-
export const HEARTBEAT_EVENTS = [
|
|
457
|
-
Server.SERVER_HEARTBEAT_STARTED,
|
|
458
|
-
Server.SERVER_HEARTBEAT_SUCCEEDED,
|
|
459
|
-
Server.SERVER_HEARTBEAT_FAILED
|
|
460
|
-
];
|
|
461
|
-
|
|
462
|
-
Object.defineProperty(Server.prototype, 'clusterTime', {
|
|
463
|
-
get() {
|
|
464
|
-
return this.s.topology.clusterTime;
|
|
465
|
-
},
|
|
466
|
-
set(clusterTime: ClusterTime) {
|
|
467
|
-
this.s.topology.clusterTime = clusterTime;
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
|
|
471
473
|
function calculateRoundTripTime(oldRtt: number, duration: number): number {
|
|
472
474
|
if (oldRtt === -1) {
|
|
473
475
|
return duration;
|