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
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
import Denque = require('denque');
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import type { ObjectId } from '../bson';
|
|
3
|
+
import {
|
|
4
|
+
APM_EVENTS,
|
|
5
|
+
CONNECTION_CHECK_OUT_FAILED,
|
|
6
|
+
CONNECTION_CHECK_OUT_STARTED,
|
|
7
|
+
CONNECTION_CHECKED_IN,
|
|
8
|
+
CONNECTION_CHECKED_OUT,
|
|
9
|
+
CONNECTION_CLOSED,
|
|
10
|
+
CONNECTION_CREATED,
|
|
11
|
+
CONNECTION_POOL_CLEARED,
|
|
12
|
+
CONNECTION_POOL_CLOSED,
|
|
13
|
+
CONNECTION_POOL_CREATED,
|
|
14
|
+
CONNECTION_READY
|
|
15
|
+
} from '../constants';
|
|
16
|
+
import { MongoError, MongoInvalidArgumentError, MongoRuntimeError } from '../error';
|
|
4
17
|
import { Logger } from '../logger';
|
|
5
|
-
import {
|
|
18
|
+
import { CancellationToken, TypedEventEmitter } from '../mongo_types';
|
|
19
|
+
import { Callback, eachAsync, makeCounter } from '../utils';
|
|
6
20
|
import { connect } from './connect';
|
|
7
|
-
import {
|
|
8
|
-
import { MongoError, MongoInvalidArgumentError, MongoRuntimeError } from '../error';
|
|
9
|
-
import { PoolClosedError, WaitQueueTimeoutError } from './errors';
|
|
21
|
+
import { Connection, ConnectionEvents, ConnectionOptions } from './connection';
|
|
10
22
|
import {
|
|
11
|
-
ConnectionPoolCreatedEvent,
|
|
12
|
-
ConnectionPoolClosedEvent,
|
|
13
|
-
ConnectionCreatedEvent,
|
|
14
|
-
ConnectionReadyEvent,
|
|
15
|
-
ConnectionClosedEvent,
|
|
16
|
-
ConnectionCheckOutStartedEvent,
|
|
17
|
-
ConnectionCheckOutFailedEvent,
|
|
18
|
-
ConnectionCheckedOutEvent,
|
|
19
23
|
ConnectionCheckedInEvent,
|
|
20
|
-
|
|
24
|
+
ConnectionCheckedOutEvent,
|
|
25
|
+
ConnectionCheckOutFailedEvent,
|
|
26
|
+
ConnectionCheckOutStartedEvent,
|
|
27
|
+
ConnectionClosedEvent,
|
|
28
|
+
ConnectionCreatedEvent,
|
|
29
|
+
ConnectionPoolClearedEvent,
|
|
30
|
+
ConnectionPoolClosedEvent,
|
|
31
|
+
ConnectionPoolCreatedEvent,
|
|
32
|
+
ConnectionReadyEvent
|
|
21
33
|
} from './connection_pool_events';
|
|
22
|
-
import {
|
|
34
|
+
import { PoolClosedError, WaitQueueTimeoutError } from './errors';
|
|
35
|
+
import { ConnectionPoolMetrics } from './metrics';
|
|
23
36
|
|
|
24
37
|
/** @internal */
|
|
25
38
|
const kLogger = Symbol('logger');
|
|
@@ -132,52 +145,52 @@ export class ConnectionPool extends TypedEventEmitter<ConnectionPoolEvents> {
|
|
|
132
145
|
* Emitted when the connection pool is created.
|
|
133
146
|
* @event
|
|
134
147
|
*/
|
|
135
|
-
static readonly CONNECTION_POOL_CREATED =
|
|
148
|
+
static readonly CONNECTION_POOL_CREATED = CONNECTION_POOL_CREATED;
|
|
136
149
|
/**
|
|
137
150
|
* Emitted once when the connection pool is closed
|
|
138
151
|
* @event
|
|
139
152
|
*/
|
|
140
|
-
static readonly CONNECTION_POOL_CLOSED =
|
|
153
|
+
static readonly CONNECTION_POOL_CLOSED = CONNECTION_POOL_CLOSED;
|
|
141
154
|
/**
|
|
142
155
|
* Emitted each time the connection pool is cleared and it's generation incremented
|
|
143
156
|
* @event
|
|
144
157
|
*/
|
|
145
|
-
static readonly CONNECTION_POOL_CLEARED =
|
|
158
|
+
static readonly CONNECTION_POOL_CLEARED = CONNECTION_POOL_CLEARED;
|
|
146
159
|
/**
|
|
147
160
|
* Emitted when a connection is created.
|
|
148
161
|
* @event
|
|
149
162
|
*/
|
|
150
|
-
static readonly CONNECTION_CREATED =
|
|
163
|
+
static readonly CONNECTION_CREATED = CONNECTION_CREATED;
|
|
151
164
|
/**
|
|
152
165
|
* Emitted when a connection becomes established, and is ready to use
|
|
153
166
|
* @event
|
|
154
167
|
*/
|
|
155
|
-
static readonly CONNECTION_READY =
|
|
168
|
+
static readonly CONNECTION_READY = CONNECTION_READY;
|
|
156
169
|
/**
|
|
157
170
|
* Emitted when a connection is closed
|
|
158
171
|
* @event
|
|
159
172
|
*/
|
|
160
|
-
static readonly CONNECTION_CLOSED =
|
|
173
|
+
static readonly CONNECTION_CLOSED = CONNECTION_CLOSED;
|
|
161
174
|
/**
|
|
162
175
|
* Emitted when an attempt to check out a connection begins
|
|
163
176
|
* @event
|
|
164
177
|
*/
|
|
165
|
-
static readonly CONNECTION_CHECK_OUT_STARTED =
|
|
178
|
+
static readonly CONNECTION_CHECK_OUT_STARTED = CONNECTION_CHECK_OUT_STARTED;
|
|
166
179
|
/**
|
|
167
180
|
* Emitted when an attempt to check out a connection fails
|
|
168
181
|
* @event
|
|
169
182
|
*/
|
|
170
|
-
static readonly CONNECTION_CHECK_OUT_FAILED =
|
|
183
|
+
static readonly CONNECTION_CHECK_OUT_FAILED = CONNECTION_CHECK_OUT_FAILED;
|
|
171
184
|
/**
|
|
172
185
|
* Emitted each time a connection is successfully checked out of the connection pool
|
|
173
186
|
* @event
|
|
174
187
|
*/
|
|
175
|
-
static readonly CONNECTION_CHECKED_OUT =
|
|
188
|
+
static readonly CONNECTION_CHECKED_OUT = CONNECTION_CHECKED_OUT;
|
|
176
189
|
/**
|
|
177
190
|
* Emitted each time a connection is successfully checked into the connection pool
|
|
178
191
|
* @event
|
|
179
192
|
*/
|
|
180
|
-
static readonly CONNECTION_CHECKED_IN =
|
|
193
|
+
static readonly CONNECTION_CHECKED_IN = CONNECTION_CHECKED_IN;
|
|
181
194
|
|
|
182
195
|
/** @internal */
|
|
183
196
|
constructor(options: ConnectionPoolOptions) {
|
|
@@ -664,19 +677,6 @@ function processWaitQueue(pool: ConnectionPool) {
|
|
|
664
677
|
}
|
|
665
678
|
}
|
|
666
679
|
|
|
667
|
-
export const CMAP_EVENTS = [
|
|
668
|
-
ConnectionPool.CONNECTION_POOL_CREATED,
|
|
669
|
-
ConnectionPool.CONNECTION_POOL_CLOSED,
|
|
670
|
-
ConnectionPool.CONNECTION_CREATED,
|
|
671
|
-
ConnectionPool.CONNECTION_READY,
|
|
672
|
-
ConnectionPool.CONNECTION_CLOSED,
|
|
673
|
-
ConnectionPool.CONNECTION_CHECK_OUT_STARTED,
|
|
674
|
-
ConnectionPool.CONNECTION_CHECK_OUT_FAILED,
|
|
675
|
-
ConnectionPool.CONNECTION_CHECKED_OUT,
|
|
676
|
-
ConnectionPool.CONNECTION_CHECKED_IN,
|
|
677
|
-
ConnectionPool.CONNECTION_POOL_CLEARED
|
|
678
|
-
] as const;
|
|
679
|
-
|
|
680
680
|
/**
|
|
681
681
|
* A callback provided to `withConnection`
|
|
682
682
|
* @internal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ObjectId } from '../bson';
|
|
2
|
+
import type { AnyError } from '../error';
|
|
2
3
|
import type { Connection } from './connection';
|
|
3
4
|
import type { ConnectionPool, ConnectionPoolOptions } from './connection_pool';
|
|
4
|
-
import type { AnyError } from '../error';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The base export class for all monitoring events published from the connection pool
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Duplex, DuplexOptions } from 'stream';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import type { BSONSerializeOptions, Document } from '../bson';
|
|
3
4
|
import { MongoDecompressionError, MongoParseError } from '../error';
|
|
4
|
-
import {
|
|
5
|
+
import type { ClientSession } from '../sessions';
|
|
6
|
+
import { BufferPool, Callback } from '../utils';
|
|
7
|
+
import { BinMsg, MessageHeader, Msg, Query, Response, WriteProtocolMessageType } from './commands';
|
|
5
8
|
import {
|
|
6
9
|
compress,
|
|
7
|
-
decompress,
|
|
8
|
-
uncompressibleCommands,
|
|
9
10
|
Compressor,
|
|
10
|
-
CompressorName
|
|
11
|
+
CompressorName,
|
|
12
|
+
decompress,
|
|
13
|
+
uncompressibleCommands
|
|
11
14
|
} from './wire_protocol/compression';
|
|
12
|
-
import
|
|
13
|
-
import { BufferPool, Callback } from '../utils';
|
|
14
|
-
import type { ClientSession } from '../sessions';
|
|
15
|
+
import { OP_COMPRESSED, OP_MSG } from './wire_protocol/constants';
|
|
15
16
|
|
|
16
17
|
const MESSAGE_HEADER_SIZE = 16;
|
|
17
18
|
const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compressorID
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { parseServerType } from '../sdam/server_description';
|
|
2
1
|
import type { Document } from '../bson';
|
|
3
|
-
import type { CompressorName } from './wire_protocol/compression';
|
|
4
2
|
import { ServerType } from '../sdam/common';
|
|
3
|
+
import { parseServerType } from '../sdam/server_description';
|
|
4
|
+
import type { CompressorName } from './wire_protocol/compression';
|
|
5
5
|
|
|
6
6
|
const RESPONSE_FIELDS = [
|
|
7
7
|
'minWireVersion',
|
|
@@ -55,8 +55,8 @@ export class StreamDescription {
|
|
|
55
55
|
|
|
56
56
|
receiveResponse(response: Document): void {
|
|
57
57
|
this.type = parseServerType(response);
|
|
58
|
-
|
|
59
|
-
if (
|
|
58
|
+
for (const field of RESPONSE_FIELDS) {
|
|
59
|
+
if (response[field] != null) {
|
|
60
60
|
this[field] = response[field];
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -64,7 +64,7 @@ export class StreamDescription {
|
|
|
64
64
|
if ('__nodejs_mock_server__' in response) {
|
|
65
65
|
this.__nodejs_mock_server__ = response['__nodejs_mock_server__'];
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
68
|
|
|
69
69
|
if (response.compression) {
|
|
70
70
|
this.compressor = this.compressors.filter(c => response.compression?.includes(c))[0];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as zlib from 'zlib';
|
|
2
|
-
import type { Callback } from '../../utils';
|
|
3
|
-
import type { OperationDescription } from '../message_stream';
|
|
4
2
|
|
|
5
3
|
import { PKG_VERSION, Snappy } from '../../deps';
|
|
6
4
|
import { MongoDecompressionError, MongoInvalidArgumentError } from '../../error';
|
|
5
|
+
import type { Callback } from '../../utils';
|
|
6
|
+
import type { OperationDescription } from '../message_stream';
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export const Compressor = Object.freeze({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const MIN_SUPPORTED_SERVER_VERSION = '
|
|
2
|
-
export const MAX_SUPPORTED_SERVER_VERSION = '5.
|
|
3
|
-
export const MIN_SUPPORTED_WIRE_VERSION =
|
|
4
|
-
export const MAX_SUPPORTED_WIRE_VERSION =
|
|
1
|
+
export const MIN_SUPPORTED_SERVER_VERSION = '3.6';
|
|
2
|
+
export const MAX_SUPPORTED_SERVER_VERSION = '5.1';
|
|
3
|
+
export const MIN_SUPPORTED_WIRE_VERSION = 6;
|
|
4
|
+
export const MAX_SUPPORTED_WIRE_VERSION = 14;
|
|
5
5
|
export const OP_REPLY = 1;
|
|
6
6
|
export const OP_UPDATE = 2001;
|
|
7
7
|
export const OP_INSERT = 2002;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TopologyDescription } from '../../sdam/topology_description';
|
|
1
|
+
import type { Document } from '../../bson';
|
|
3
2
|
import { MongoInvalidArgumentError } from '../../error';
|
|
3
|
+
import type { ReadPreferenceLike } from '../../read_preference';
|
|
4
4
|
import { ReadPreference } from '../../read_preference';
|
|
5
|
-
import
|
|
6
|
-
import type { OpQueryOptions } from '../commands';
|
|
7
|
-
import type { Topology } from '../../sdam/topology';
|
|
5
|
+
import { ServerType } from '../../sdam/common';
|
|
8
6
|
import type { Server } from '../../sdam/server';
|
|
9
7
|
import type { ServerDescription } from '../../sdam/server_description';
|
|
10
|
-
import type {
|
|
11
|
-
import
|
|
12
|
-
import type {
|
|
8
|
+
import type { Topology } from '../../sdam/topology';
|
|
9
|
+
import { TopologyDescription } from '../../sdam/topology_description';
|
|
10
|
+
import type { OpQueryOptions } from '../commands';
|
|
11
|
+
import type { CommandOptions, Connection } from '../connection';
|
|
13
12
|
|
|
14
13
|
export interface ReadPreferenceOption {
|
|
15
14
|
readPreference?: ReadPreferenceLike;
|
|
@@ -45,7 +44,9 @@ export function applyCommonQueryOptions(
|
|
|
45
44
|
promoteLongs: typeof options.promoteLongs === 'boolean' ? options.promoteLongs : true,
|
|
46
45
|
promoteValues: typeof options.promoteValues === 'boolean' ? options.promoteValues : true,
|
|
47
46
|
promoteBuffers: typeof options.promoteBuffers === 'boolean' ? options.promoteBuffers : false,
|
|
48
|
-
bsonRegExp: typeof options.bsonRegExp === 'boolean' ? options.bsonRegExp : false
|
|
47
|
+
bsonRegExp: typeof options.bsonRegExp === 'boolean' ? options.bsonRegExp : false,
|
|
48
|
+
enableUtf8Validation:
|
|
49
|
+
typeof options.enableUtf8Validation === 'boolean' ? options.enableUtf8Validation : true
|
|
49
50
|
});
|
|
50
51
|
|
|
51
52
|
if (options.session) {
|