mongodb 4.2.1 → 4.4.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 +2 -2
- package/lib/admin.js +3 -3
- package/lib/admin.js.map +1 -1
- package/lib/bson.js +16 -14
- package/lib/bson.js.map +1 -1
- package/lib/bulk/common.js +7 -7
- package/lib/bulk/common.js.map +1 -1
- package/lib/bulk/ordered.js +1 -1
- package/lib/bulk/ordered.js.map +1 -1
- package/lib/bulk/unordered.js +1 -1
- package/lib/bulk/unordered.js.map +1 -1
- package/lib/change_stream.js +6 -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 +52 -10
- package/lib/cmap/auth/gssapi.js.map +1 -1
- package/lib/cmap/auth/mongo_credentials.js +36 -27
- package/lib/cmap/auth/mongo_credentials.js.map +1 -1
- package/lib/cmap/auth/mongocr.js +2 -2
- package/lib/cmap/auth/mongocr.js.map +1 -1
- package/lib/cmap/auth/mongodb_aws.js +6 -6
- package/lib/cmap/auth/mongodb_aws.js.map +1 -1
- package/lib/cmap/auth/plain.js +1 -1
- package/lib/cmap/auth/plain.js.map +1 -1
- package/lib/cmap/auth/providers.js +21 -0
- package/lib/cmap/auth/providers.js.map +1 -0
- package/lib/cmap/auth/scram.js +4 -4
- package/lib/cmap/auth/scram.js.map +1 -1
- package/lib/cmap/auth/x509.js +1 -1
- package/lib/cmap/auth/x509.js.map +1 -1
- package/lib/cmap/command_monitoring_events.js +3 -2
- package/lib/cmap/command_monitoring_events.js.map +1 -1
- package/lib/cmap/commands.js +14 -8
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connect.js +119 -37
- package/lib/cmap/connect.js.map +1 -1
- package/lib/cmap/connection.js +36 -35
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/connection_pool.js +19 -30
- package/lib/cmap/connection_pool.js.map +1 -1
- package/lib/cmap/message_stream.js +3 -3
- package/lib/cmap/message_stream.js.map +1 -1
- package/lib/cmap/stream_description.js +4 -4
- package/lib/cmap/stream_description.js.map +1 -1
- package/lib/cmap/wire_protocol/compression.js +2 -1
- package/lib/cmap/wire_protocol/compression.js.map +1 -1
- package/lib/cmap/wire_protocol/shared.js +4 -3
- package/lib/cmap/wire_protocol/shared.js.map +1 -1
- package/lib/collection.js +46 -47
- package/lib/collection.js.map +1 -1
- package/lib/connection_string.js +93 -54
- package/lib/connection_string.js.map +1 -1
- package/lib/constants.js +113 -1
- package/lib/constants.js.map +1 -1
- package/lib/cursor/abstract_cursor.js +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 +2 -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 +83 -81
- package/lib/index.js.map +1 -1
- package/lib/logger.js +1 -1
- package/lib/logger.js.map +1 -1
- package/lib/mongo_client.js +5 -5
- package/lib/mongo_client.js.map +1 -1
- package/lib/mongo_types.js.map +1 -1
- package/lib/operations/add_user.js +3 -3
- package/lib/operations/add_user.js.map +1 -1
- package/lib/operations/aggregate.js +1 -1
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/bulk_write.js.map +1 -1
- package/lib/operations/collections.js +1 -1
- package/lib/operations/collections.js.map +1 -1
- package/lib/operations/command.js +5 -6
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/common_functions.js.map +1 -1
- package/lib/operations/connect.js +4 -13
- package/lib/operations/connect.js.map +1 -1
- package/lib/operations/count.js +1 -1
- package/lib/operations/count.js.map +1 -1
- package/lib/operations/count_documents.js.map +1 -1
- package/lib/operations/create_collection.js +3 -2
- package/lib/operations/create_collection.js.map +1 -1
- package/lib/operations/delete.js +3 -3
- package/lib/operations/delete.js.map +1 -1
- package/lib/operations/distinct.js +3 -3
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/drop.js +1 -1
- package/lib/operations/drop.js.map +1 -1
- package/lib/operations/estimated_document_count.js +2 -2
- package/lib/operations/estimated_document_count.js.map +1 -1
- package/lib/operations/eval.js +2 -2
- package/lib/operations/eval.js.map +1 -1
- package/lib/operations/execute_operation.js +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 +15 -5
- package/lib/read_preference.js.map +1 -1
- package/lib/sdam/events.js +4 -4
- package/lib/sdam/monitor.js +19 -18
- package/lib/sdam/monitor.js.map +1 -1
- package/lib/sdam/server.js +24 -31
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/server_description.js +38 -38
- package/lib/sdam/server_description.js.map +1 -1
- package/lib/sdam/server_selection.js +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 +32 -62
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +3 -3
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +13 -28
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js +1 -1
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +46 -15
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +205 -60
- package/mongodb.ts34.d.ts +230 -59
- package/package.json +40 -37
- package/src/admin.ts +9 -9
- package/src/bson.ts +25 -17
- package/src/bulk/common.ts +22 -23
- package/src/bulk/ordered.ts +4 -4
- package/src/bulk/unordered.ts +5 -5
- package/src/change_stream.ts +29 -28
- package/src/cmap/auth/auth_provider.ts +3 -3
- package/src/cmap/auth/gssapi.ts +65 -14
- package/src/cmap/auth/mongo_credentials.ts +28 -17
- package/src/cmap/auth/mongocr.ts +3 -2
- package/src/cmap/auth/mongodb_aws.ts +10 -11
- package/src/cmap/auth/plain.ts +1 -1
- package/src/cmap/auth/providers.ts +21 -0
- package/src/cmap/auth/scram.ts +9 -9
- package/src/cmap/auth/x509.ts +3 -3
- package/src/cmap/command_monitoring_events.ts +4 -3
- package/src/cmap/commands.ts +22 -14
- package/src/cmap/connect.ts +161 -45
- package/src/cmap/connection.ts +83 -63
- package/src/cmap/connection_pool.ts +39 -39
- package/src/cmap/connection_pool_events.ts +1 -1
- package/src/cmap/message_stream.ts +9 -8
- package/src/cmap/stream_description.ts +5 -5
- package/src/cmap/wire_protocol/compression.ts +4 -3
- package/src/cmap/wire_protocol/shared.ts +10 -9
- package/src/collection.ts +116 -93
- package/src/connection_string.ts +130 -59
- package/src/constants.ts +122 -0
- package/src/cursor/abstract_cursor.ts +14 -13
- package/src/cursor/aggregation_cursor.ts +6 -6
- package/src/cursor/find_cursor.ts +12 -4
- package/src/db.ts +44 -33
- package/src/deps.ts +44 -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 +205 -199
- package/src/logger.ts +2 -1
- package/src/mongo_client.ts +46 -32
- package/src/mongo_types.ts +119 -21
- package/src/operations/add_user.ts +7 -6
- package/src/operations/aggregate.ts +5 -5
- package/src/operations/bulk_write.ts +5 -5
- package/src/operations/collections.ts +2 -2
- package/src/operations/command.ts +15 -9
- package/src/operations/common_functions.ts +4 -4
- package/src/operations/connect.ts +4 -14
- package/src/operations/count.ts +4 -4
- package/src/operations/count_documents.ts +3 -3
- package/src/operations/create_collection.ts +7 -6
- package/src/operations/delete.ts +5 -5
- package/src/operations/distinct.ts +4 -4
- package/src/operations/drop.ts +4 -4
- package/src/operations/estimated_document_count.ts +5 -5
- package/src/operations/eval.ts +5 -5
- package/src/operations/execute_operation.ts +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 +18 -7
- package/src/sdam/common.ts +2 -2
- package/src/sdam/events.ts +5 -5
- package/src/sdam/monitor.ts +29 -32
- package/src/sdam/server.ts +64 -62
- package/src/sdam/server_description.ts +41 -48
- package/src/sdam/server_selection.ts +3 -3
- package/src/sdam/srv_polling.ts +3 -2
- package/src/sdam/topology.ts +71 -89
- package/src/sdam/topology_description.ts +5 -5
- package/src/sessions.ts +31 -48
- package/src/transactions.ts +4 -4
- package/src/utils.ts +64 -28
- 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/collection.ts
CHANGED
|
@@ -1,105 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
normalizeHintField,
|
|
5
|
-
checkCollectionName,
|
|
6
|
-
MongoDBNamespace,
|
|
7
|
-
Callback,
|
|
8
|
-
getTopology
|
|
9
|
-
} from './utils';
|
|
10
|
-
import { Document, BSONSerializeOptions, resolveBSONOptions } from './bson';
|
|
11
|
-
import { MongoInvalidArgumentError } from './error';
|
|
12
|
-
import { UnorderedBulkOperation } from './bulk/unordered';
|
|
1
|
+
import { BSONSerializeOptions, Document, resolveBSONOptions } from './bson';
|
|
2
|
+
import type { AnyBulkWriteOperation, BulkWriteOptions, BulkWriteResult } from './bulk/common';
|
|
13
3
|
import { OrderedBulkOperation } from './bulk/ordered';
|
|
4
|
+
import { UnorderedBulkOperation } from './bulk/unordered';
|
|
14
5
|
import { ChangeStream, ChangeStreamOptions } from './change_stream';
|
|
15
|
-
import { WriteConcern, WriteConcernOptions } from './write_concern';
|
|
16
|
-
import { ReadConcern, ReadConcernLike } from './read_concern';
|
|
17
6
|
import { AggregationCursor } from './cursor/aggregation_cursor';
|
|
7
|
+
import { FindCursor } from './cursor/find_cursor';
|
|
8
|
+
import type { Db } from './db';
|
|
9
|
+
import { MongoInvalidArgumentError } from './error';
|
|
10
|
+
import type { Logger, LoggerOptions } from './logger';
|
|
11
|
+
import type { PkFactory } from './mongo_client';
|
|
12
|
+
import type {
|
|
13
|
+
Filter,
|
|
14
|
+
Flatten,
|
|
15
|
+
OptionalUnlessRequiredId,
|
|
16
|
+
TODO_NODE_3286,
|
|
17
|
+
UpdateFilter,
|
|
18
|
+
WithId,
|
|
19
|
+
WithoutId
|
|
20
|
+
} from './mongo_types';
|
|
18
21
|
import type { AggregateOptions } from './operations/aggregate';
|
|
19
22
|
import { BulkWriteOperation } from './operations/bulk_write';
|
|
23
|
+
import type { IndexInformationOptions } from './operations/common_functions';
|
|
24
|
+
import { CountOperation, CountOptions } from './operations/count';
|
|
20
25
|
import { CountDocumentsOperation, CountDocumentsOptions } from './operations/count_documents';
|
|
21
26
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
IndexExistsOperation,
|
|
28
|
-
IndexInformationOperation,
|
|
29
|
-
CreateIndexesOptions,
|
|
30
|
-
DropIndexesOptions,
|
|
31
|
-
ListIndexesOptions,
|
|
32
|
-
IndexSpecification,
|
|
33
|
-
IndexDescription,
|
|
34
|
-
ListIndexesCursor
|
|
35
|
-
} from './operations/indexes';
|
|
27
|
+
DeleteManyOperation,
|
|
28
|
+
DeleteOneOperation,
|
|
29
|
+
DeleteOptions,
|
|
30
|
+
DeleteResult
|
|
31
|
+
} from './operations/delete';
|
|
36
32
|
import { DistinctOperation, DistinctOptions } from './operations/distinct';
|
|
37
33
|
import { DropCollectionOperation, DropCollectionOptions } from './operations/drop';
|
|
38
34
|
import {
|
|
39
35
|
EstimatedDocumentCountOperation,
|
|
40
36
|
EstimatedDocumentCountOptions
|
|
41
37
|
} from './operations/estimated_document_count';
|
|
38
|
+
import { executeOperation } from './operations/execute_operation';
|
|
42
39
|
import type { FindOptions } from './operations/find';
|
|
43
40
|
import {
|
|
44
41
|
FindOneAndDeleteOperation,
|
|
45
|
-
FindOneAndReplaceOperation,
|
|
46
|
-
FindOneAndUpdateOperation,
|
|
47
42
|
FindOneAndDeleteOptions,
|
|
43
|
+
FindOneAndReplaceOperation,
|
|
48
44
|
FindOneAndReplaceOptions,
|
|
45
|
+
FindOneAndUpdateOperation,
|
|
49
46
|
FindOneAndUpdateOptions
|
|
50
47
|
} from './operations/find_and_modify';
|
|
51
48
|
import {
|
|
49
|
+
CreateIndexesOperation,
|
|
50
|
+
CreateIndexesOptions,
|
|
51
|
+
CreateIndexOperation,
|
|
52
|
+
DropIndexesOperation,
|
|
53
|
+
DropIndexesOptions,
|
|
54
|
+
DropIndexOperation,
|
|
55
|
+
IndexDescription,
|
|
56
|
+
IndexesOperation,
|
|
57
|
+
IndexExistsOperation,
|
|
58
|
+
IndexInformationOperation,
|
|
59
|
+
IndexSpecification,
|
|
60
|
+
ListIndexesCursor,
|
|
61
|
+
ListIndexesOptions
|
|
62
|
+
} from './operations/indexes';
|
|
63
|
+
import {
|
|
64
|
+
InsertManyOperation,
|
|
65
|
+
InsertManyResult,
|
|
52
66
|
InsertOneOperation,
|
|
53
67
|
InsertOneOptions,
|
|
54
|
-
InsertOneResult
|
|
55
|
-
InsertManyOperation,
|
|
56
|
-
InsertManyResult
|
|
68
|
+
InsertOneResult
|
|
57
69
|
} from './operations/insert';
|
|
58
|
-
import {
|
|
59
|
-
UpdateOneOperation,
|
|
60
|
-
UpdateManyOperation,
|
|
61
|
-
UpdateOptions,
|
|
62
|
-
UpdateResult,
|
|
63
|
-
ReplaceOneOperation,
|
|
64
|
-
ReplaceOptions
|
|
65
|
-
} from './operations/update';
|
|
66
|
-
import {
|
|
67
|
-
DeleteOneOperation,
|
|
68
|
-
DeleteManyOperation,
|
|
69
|
-
DeleteOptions,
|
|
70
|
-
DeleteResult
|
|
71
|
-
} from './operations/delete';
|
|
72
70
|
import { IsCappedOperation } from './operations/is_capped';
|
|
73
71
|
import {
|
|
74
|
-
MapReduceOperation,
|
|
75
72
|
MapFunction,
|
|
76
|
-
|
|
77
|
-
MapReduceOptions
|
|
73
|
+
MapReduceOperation,
|
|
74
|
+
MapReduceOptions,
|
|
75
|
+
ReduceFunction
|
|
78
76
|
} from './operations/map_reduce';
|
|
77
|
+
import type { Hint, OperationOptions } from './operations/operation';
|
|
79
78
|
import { OptionsOperation } from './operations/options_operation';
|
|
80
79
|
import { RenameOperation, RenameOptions } from './operations/rename';
|
|
81
80
|
import { CollStats, CollStatsOperation, CollStatsOptions } from './operations/stats';
|
|
82
|
-
import {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
import
|
|
91
|
-
import
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
import {
|
|
82
|
+
ReplaceOneOperation,
|
|
83
|
+
ReplaceOptions,
|
|
84
|
+
UpdateManyOperation,
|
|
85
|
+
UpdateOneOperation,
|
|
86
|
+
UpdateOptions,
|
|
87
|
+
UpdateResult
|
|
88
|
+
} from './operations/update';
|
|
89
|
+
import { ReadConcern, ReadConcernLike } from './read_concern';
|
|
90
|
+
import { ReadPreference, ReadPreferenceLike } from './read_preference';
|
|
91
|
+
import {
|
|
92
|
+
Callback,
|
|
93
|
+
checkCollectionName,
|
|
94
|
+
DEFAULT_PK_FACTORY,
|
|
95
|
+
emitWarningOnce,
|
|
96
|
+
getTopology,
|
|
97
|
+
MongoDBNamespace,
|
|
98
|
+
normalizeHintField,
|
|
99
|
+
resolveOptions
|
|
100
|
+
} from './utils';
|
|
101
|
+
import { WriteConcern, WriteConcernOptions } from './write_concern';
|
|
99
102
|
|
|
100
103
|
/** @public */
|
|
101
104
|
export interface ModifyResult<TSchema = Document> {
|
|
102
|
-
value: TSchema | null;
|
|
105
|
+
value: WithId<TSchema> | null;
|
|
103
106
|
lastErrorObject?: Document;
|
|
104
107
|
ok: 0 | 1;
|
|
105
108
|
}
|
|
@@ -109,6 +112,9 @@ export interface CollectionOptions
|
|
|
109
112
|
extends BSONSerializeOptions,
|
|
110
113
|
WriteConcernOptions,
|
|
111
114
|
LoggerOptions {
|
|
115
|
+
/**
|
|
116
|
+
* @deprecated Use readPreference instead
|
|
117
|
+
*/
|
|
112
118
|
slaveOk?: boolean;
|
|
113
119
|
/** Specify a read concern for the collection. (only MongoDB 3.2 or higher supported) */
|
|
114
120
|
readConcern?: ReadConcernLike;
|
|
@@ -124,7 +130,6 @@ export interface CollectionPrivate {
|
|
|
124
130
|
namespace: MongoDBNamespace;
|
|
125
131
|
readPreference?: ReadPreference;
|
|
126
132
|
bsonOptions: BSONSerializeOptions;
|
|
127
|
-
slaveOk?: boolean;
|
|
128
133
|
collectionHint?: Hint;
|
|
129
134
|
readConcern?: ReadConcern;
|
|
130
135
|
writeConcern?: WriteConcern;
|
|
@@ -178,8 +183,7 @@ export class Collection<TSchema extends Document = Document> {
|
|
|
178
183
|
readPreference: ReadPreference.fromOptions(options),
|
|
179
184
|
bsonOptions: resolveBSONOptions(options, db),
|
|
180
185
|
readConcern: ReadConcern.fromOptions(options),
|
|
181
|
-
writeConcern: WriteConcern.fromOptions(options)
|
|
182
|
-
slaveOk: options == null || options.slaveOk == null ? db.slaveOk : options.slaveOk
|
|
186
|
+
writeConcern: WriteConcern.fromOptions(options)
|
|
183
187
|
};
|
|
184
188
|
}
|
|
185
189
|
|
|
@@ -261,16 +265,22 @@ export class Collection<TSchema extends Document = Document> {
|
|
|
261
265
|
* @param options - Optional settings for the command
|
|
262
266
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
263
267
|
*/
|
|
264
|
-
insertOne(doc:
|
|
265
|
-
insertOne(
|
|
266
|
-
|
|
268
|
+
insertOne(doc: OptionalUnlessRequiredId<TSchema>): Promise<InsertOneResult<TSchema>>;
|
|
269
|
+
insertOne(
|
|
270
|
+
doc: OptionalUnlessRequiredId<TSchema>,
|
|
271
|
+
callback: Callback<InsertOneResult<TSchema>>
|
|
272
|
+
): void;
|
|
267
273
|
insertOne(
|
|
268
|
-
doc:
|
|
274
|
+
doc: OptionalUnlessRequiredId<TSchema>,
|
|
275
|
+
options: InsertOneOptions
|
|
276
|
+
): Promise<InsertOneResult<TSchema>>;
|
|
277
|
+
insertOne(
|
|
278
|
+
doc: OptionalUnlessRequiredId<TSchema>,
|
|
269
279
|
options: InsertOneOptions,
|
|
270
280
|
callback: Callback<InsertOneResult<TSchema>>
|
|
271
281
|
): void;
|
|
272
282
|
insertOne(
|
|
273
|
-
doc:
|
|
283
|
+
doc: OptionalUnlessRequiredId<TSchema>,
|
|
274
284
|
options?: InsertOneOptions | Callback<InsertOneResult<TSchema>>,
|
|
275
285
|
callback?: Callback<InsertOneResult<TSchema>>
|
|
276
286
|
): Promise<InsertOneResult<TSchema>> | void {
|
|
@@ -305,19 +315,22 @@ export class Collection<TSchema extends Document = Document> {
|
|
|
305
315
|
* @param options - Optional settings for the command
|
|
306
316
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
307
317
|
*/
|
|
308
|
-
insertMany(docs:
|
|
309
|
-
insertMany(
|
|
318
|
+
insertMany(docs: OptionalUnlessRequiredId<TSchema>[]): Promise<InsertManyResult<TSchema>>;
|
|
319
|
+
insertMany(
|
|
320
|
+
docs: OptionalUnlessRequiredId<TSchema>[],
|
|
321
|
+
callback: Callback<InsertManyResult<TSchema>>
|
|
322
|
+
): void;
|
|
310
323
|
insertMany(
|
|
311
|
-
docs:
|
|
324
|
+
docs: OptionalUnlessRequiredId<TSchema>[],
|
|
312
325
|
options: BulkWriteOptions
|
|
313
326
|
): Promise<InsertManyResult<TSchema>>;
|
|
314
327
|
insertMany(
|
|
315
|
-
docs:
|
|
328
|
+
docs: OptionalUnlessRequiredId<TSchema>[],
|
|
316
329
|
options: BulkWriteOptions,
|
|
317
330
|
callback: Callback<InsertManyResult<TSchema>>
|
|
318
331
|
): void;
|
|
319
332
|
insertMany(
|
|
320
|
-
docs:
|
|
333
|
+
docs: OptionalUnlessRequiredId<TSchema>[],
|
|
321
334
|
options?: BulkWriteOptions | Callback<InsertManyResult<TSchema>>,
|
|
322
335
|
callback?: Callback<InsertManyResult<TSchema>>
|
|
323
336
|
): Promise<InsertManyResult<TSchema>> | void {
|
|
@@ -459,26 +472,29 @@ export class Collection<TSchema extends Document = Document> {
|
|
|
459
472
|
* @param options - Optional settings for the command
|
|
460
473
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
461
474
|
*/
|
|
462
|
-
replaceOne(filter: Filter<TSchema>, replacement: TSchema): Promise<UpdateResult | Document>;
|
|
463
475
|
replaceOne(
|
|
464
476
|
filter: Filter<TSchema>,
|
|
465
|
-
replacement: TSchema
|
|
477
|
+
replacement: WithoutId<TSchema>
|
|
478
|
+
): Promise<UpdateResult | Document>;
|
|
479
|
+
replaceOne(
|
|
480
|
+
filter: Filter<TSchema>,
|
|
481
|
+
replacement: WithoutId<TSchema>,
|
|
466
482
|
callback: Callback<UpdateResult | Document>
|
|
467
483
|
): void;
|
|
468
484
|
replaceOne(
|
|
469
485
|
filter: Filter<TSchema>,
|
|
470
|
-
replacement: TSchema
|
|
486
|
+
replacement: WithoutId<TSchema>,
|
|
471
487
|
options: ReplaceOptions
|
|
472
488
|
): Promise<UpdateResult | Document>;
|
|
473
489
|
replaceOne(
|
|
474
490
|
filter: Filter<TSchema>,
|
|
475
|
-
replacement: TSchema
|
|
491
|
+
replacement: WithoutId<TSchema>,
|
|
476
492
|
options: ReplaceOptions,
|
|
477
493
|
callback: Callback<UpdateResult | Document>
|
|
478
494
|
): void;
|
|
479
495
|
replaceOne(
|
|
480
496
|
filter: Filter<TSchema>,
|
|
481
|
-
replacement: TSchema
|
|
497
|
+
replacement: WithoutId<TSchema>,
|
|
482
498
|
options?: ReplaceOptions | Callback<UpdateResult | Document>,
|
|
483
499
|
callback?: Callback<UpdateResult | Document>
|
|
484
500
|
): Promise<UpdateResult | Document> | void {
|
|
@@ -1279,26 +1295,29 @@ export class Collection<TSchema extends Document = Document> {
|
|
|
1279
1295
|
* @param options - Optional settings for the command
|
|
1280
1296
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1281
1297
|
*/
|
|
1282
|
-
findOneAndReplace(filter: Filter<TSchema>, replacement: Document): Promise<ModifyResult<TSchema>>;
|
|
1283
1298
|
findOneAndReplace(
|
|
1284
1299
|
filter: Filter<TSchema>,
|
|
1285
|
-
replacement:
|
|
1300
|
+
replacement: WithoutId<TSchema>
|
|
1301
|
+
): Promise<ModifyResult<TSchema>>;
|
|
1302
|
+
findOneAndReplace(
|
|
1303
|
+
filter: Filter<TSchema>,
|
|
1304
|
+
replacement: WithoutId<TSchema>,
|
|
1286
1305
|
callback: Callback<ModifyResult<TSchema>>
|
|
1287
1306
|
): void;
|
|
1288
1307
|
findOneAndReplace(
|
|
1289
1308
|
filter: Filter<TSchema>,
|
|
1290
|
-
replacement:
|
|
1309
|
+
replacement: WithoutId<TSchema>,
|
|
1291
1310
|
options: FindOneAndReplaceOptions
|
|
1292
1311
|
): Promise<ModifyResult<TSchema>>;
|
|
1293
1312
|
findOneAndReplace(
|
|
1294
1313
|
filter: Filter<TSchema>,
|
|
1295
|
-
replacement:
|
|
1314
|
+
replacement: WithoutId<TSchema>,
|
|
1296
1315
|
options: FindOneAndReplaceOptions,
|
|
1297
1316
|
callback: Callback<ModifyResult<TSchema>>
|
|
1298
1317
|
): void;
|
|
1299
1318
|
findOneAndReplace(
|
|
1300
1319
|
filter: Filter<TSchema>,
|
|
1301
|
-
replacement:
|
|
1320
|
+
replacement: WithoutId<TSchema>,
|
|
1302
1321
|
options?: FindOneAndReplaceOptions | Callback<ModifyResult<TSchema>>,
|
|
1303
1322
|
callback?: Callback<ModifyResult<TSchema>>
|
|
1304
1323
|
): Promise<ModifyResult<TSchema>> | void {
|
|
@@ -1517,7 +1536,7 @@ export class Collection<TSchema extends Document = Document> {
|
|
|
1517
1536
|
* @param callback - An optional callback, a Promise will be returned if none is provided
|
|
1518
1537
|
*/
|
|
1519
1538
|
insert(
|
|
1520
|
-
docs:
|
|
1539
|
+
docs: OptionalUnlessRequiredId<TSchema>[],
|
|
1521
1540
|
options: BulkWriteOptions,
|
|
1522
1541
|
callback: Callback<InsertManyResult<TSchema>>
|
|
1523
1542
|
): Promise<InsertManyResult<TSchema>> | void {
|
|
@@ -1618,7 +1637,11 @@ export class Collection<TSchema extends Document = Document> {
|
|
|
1618
1637
|
filter ??= {};
|
|
1619
1638
|
return executeOperation(
|
|
1620
1639
|
getTopology(this),
|
|
1621
|
-
new
|
|
1640
|
+
new CountOperation(
|
|
1641
|
+
MongoDBNamespace.fromString(this.namespace),
|
|
1642
|
+
filter,
|
|
1643
|
+
resolveOptions(this, options)
|
|
1644
|
+
),
|
|
1622
1645
|
callback
|
|
1623
1646
|
);
|
|
1624
1647
|
}
|
package/src/connection_string.ts
CHANGED
|
@@ -2,22 +2,14 @@ import * as dns from 'dns';
|
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import ConnectionString from 'mongodb-connection-string-url';
|
|
4
4
|
import { URLSearchParams } from 'url';
|
|
5
|
-
|
|
6
|
-
import { ReadPreference, ReadPreferenceMode } from './read_preference';
|
|
7
|
-
import { ReadConcern, ReadConcernLevel } from './read_concern';
|
|
8
|
-
import { W, WriteConcern } from './write_concern';
|
|
9
|
-
import { MongoAPIError, MongoInvalidArgumentError, MongoParseError } from './error';
|
|
10
|
-
import {
|
|
11
|
-
AnyOptions,
|
|
12
|
-
Callback,
|
|
13
|
-
DEFAULT_PK_FACTORY,
|
|
14
|
-
isRecord,
|
|
15
|
-
makeClientMetadata,
|
|
16
|
-
setDifference,
|
|
17
|
-
HostAddress,
|
|
18
|
-
emitWarning
|
|
19
|
-
} from './utils';
|
|
5
|
+
|
|
20
6
|
import type { Document } from './bson';
|
|
7
|
+
import { MongoCredentials } from './cmap/auth/mongo_credentials';
|
|
8
|
+
import { AUTH_MECHS_AUTH_SRC_EXTERNAL, AuthMechanism } from './cmap/auth/providers';
|
|
9
|
+
import { Compressor, CompressorName } from './cmap/wire_protocol/compression';
|
|
10
|
+
import { Encrypter } from './encrypter';
|
|
11
|
+
import { MongoAPIError, MongoInvalidArgumentError, MongoParseError } from './error';
|
|
12
|
+
import { Logger, LoggerLevel } from './logger';
|
|
21
13
|
import {
|
|
22
14
|
DriverInfo,
|
|
23
15
|
MongoClient,
|
|
@@ -27,12 +19,23 @@ import {
|
|
|
27
19
|
ServerApi,
|
|
28
20
|
ServerApiVersion
|
|
29
21
|
} from './mongo_client';
|
|
30
|
-
import {
|
|
31
|
-
import type { TagSet } from './sdam/server_description';
|
|
32
|
-
import { Logger, LoggerLevel } from './logger';
|
|
22
|
+
import type { OneOrMore } from './mongo_types';
|
|
33
23
|
import { PromiseProvider } from './promise_provider';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
24
|
+
import { ReadConcern, ReadConcernLevel } from './read_concern';
|
|
25
|
+
import { ReadPreference, ReadPreferenceMode } from './read_preference';
|
|
26
|
+
import type { TagSet } from './sdam/server_description';
|
|
27
|
+
import {
|
|
28
|
+
AnyOptions,
|
|
29
|
+
Callback,
|
|
30
|
+
DEFAULT_PK_FACTORY,
|
|
31
|
+
emitWarning,
|
|
32
|
+
emitWarningOnce,
|
|
33
|
+
HostAddress,
|
|
34
|
+
isRecord,
|
|
35
|
+
makeClientMetadata,
|
|
36
|
+
setDifference
|
|
37
|
+
} from './utils';
|
|
38
|
+
import { W, WriteConcern } from './write_concern';
|
|
36
39
|
|
|
37
40
|
const VALID_TXT_RECORDS = ['authSource', 'replicaSet', 'loadBalanced'];
|
|
38
41
|
|
|
@@ -124,7 +127,12 @@ export function resolveSRVRecord(options: MongoOptions, callback: Callback<HostA
|
|
|
124
127
|
const replicaSet = txtRecordOptions.get('replicaSet') ?? undefined;
|
|
125
128
|
const loadBalanced = txtRecordOptions.get('loadBalanced') ?? undefined;
|
|
126
129
|
|
|
127
|
-
if (
|
|
130
|
+
if (
|
|
131
|
+
!options.userSpecifiedAuthSource &&
|
|
132
|
+
source &&
|
|
133
|
+
options.credentials &&
|
|
134
|
+
!AUTH_MECHS_AUTH_SRC_EXTERNAL.has(options.credentials.mechanism)
|
|
135
|
+
) {
|
|
128
136
|
options.credentials = MongoCredentials.merge(options.credentials, { source });
|
|
129
137
|
}
|
|
130
138
|
|
|
@@ -178,8 +186,22 @@ const FALSEHOODS = new Set(['false', 'f', '0', 'n', 'no', '-1']);
|
|
|
178
186
|
function getBoolean(name: string, value: unknown): boolean {
|
|
179
187
|
if (typeof value === 'boolean') return value;
|
|
180
188
|
const valueString = String(value).toLowerCase();
|
|
181
|
-
if (TRUTHS.has(valueString))
|
|
182
|
-
|
|
189
|
+
if (TRUTHS.has(valueString)) {
|
|
190
|
+
if (valueString !== 'true') {
|
|
191
|
+
emitWarningOnce(
|
|
192
|
+
`deprecated value for ${name} : ${valueString} - please update to ${name} : true instead`
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
if (FALSEHOODS.has(valueString)) {
|
|
198
|
+
if (valueString !== 'false') {
|
|
199
|
+
emitWarningOnce(
|
|
200
|
+
`deprecated value for ${name} : ${valueString} - please update to ${name} : false instead`
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
183
205
|
throw new MongoParseError(`Expected ${name} to be stringified boolean value, got: ${value}`);
|
|
184
206
|
}
|
|
185
207
|
|
|
@@ -198,31 +220,24 @@ function getUint(name: string, value: unknown): number {
|
|
|
198
220
|
return parsedValue;
|
|
199
221
|
}
|
|
200
222
|
|
|
201
|
-
|
|
202
|
-
|
|
223
|
+
/** Wrap a single value in an array if the value is not an array */
|
|
224
|
+
function toArray<T>(value: OneOrMore<T>): T[] {
|
|
225
|
+
return Array.isArray(value) ? value : [value];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function* entriesFromString(value: string) {
|
|
203
229
|
const keyValuePairs = value.split(',');
|
|
204
230
|
for (const keyValue of keyValuePairs) {
|
|
205
231
|
const [key, value] = keyValue.split(':');
|
|
206
232
|
if (value == null) {
|
|
207
233
|
throw new MongoParseError('Cannot have undefined values in key value pairs');
|
|
208
234
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
record[key] = getBoolean('', value);
|
|
212
|
-
} catch {
|
|
213
|
-
try {
|
|
214
|
-
// try to get a number
|
|
215
|
-
record[key] = getInt('', value);
|
|
216
|
-
} catch {
|
|
217
|
-
// keep value as a string
|
|
218
|
-
record[key] = value;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
235
|
+
|
|
236
|
+
yield [key, value];
|
|
221
237
|
}
|
|
222
|
-
return record;
|
|
223
238
|
}
|
|
224
239
|
|
|
225
|
-
class CaseInsensitiveMap extends Map<string,
|
|
240
|
+
class CaseInsensitiveMap<Value = any> extends Map<string, Value> {
|
|
226
241
|
constructor(entries: Array<[string, any]> = []) {
|
|
227
242
|
super(entries.map(([k, v]) => [k.toLowerCase(), v]));
|
|
228
243
|
}
|
|
@@ -256,7 +271,7 @@ export function parseOptions(
|
|
|
256
271
|
const mongoOptions = Object.create(null);
|
|
257
272
|
mongoOptions.hosts = isSRV ? [] : hosts.map(HostAddress.fromString);
|
|
258
273
|
|
|
259
|
-
const urlOptions = new CaseInsensitiveMap();
|
|
274
|
+
const urlOptions = new CaseInsensitiveMap<any[]>();
|
|
260
275
|
|
|
261
276
|
if (url.pathname !== '/' && url.pathname !== '') {
|
|
262
277
|
const dbName = decodeURIComponent(
|
|
@@ -318,16 +333,11 @@ export function parseOptions(
|
|
|
318
333
|
]);
|
|
319
334
|
|
|
320
335
|
for (const key of allKeys) {
|
|
321
|
-
const values = []
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
values.push(...urlOptions.get(key));
|
|
327
|
-
}
|
|
328
|
-
if (DEFAULT_OPTIONS.has(key)) {
|
|
329
|
-
values.push(DEFAULT_OPTIONS.get(key));
|
|
330
|
-
}
|
|
336
|
+
const values = [objectOptions, urlOptions, DEFAULT_OPTIONS].flatMap(optionsObject => {
|
|
337
|
+
const options = optionsObject.get(key) ?? [];
|
|
338
|
+
return toArray(options);
|
|
339
|
+
});
|
|
340
|
+
|
|
331
341
|
allOptions.set(key, values);
|
|
332
342
|
}
|
|
333
343
|
|
|
@@ -388,6 +398,16 @@ export function parseOptions(
|
|
|
388
398
|
}
|
|
389
399
|
|
|
390
400
|
mongoOptions.credentials.validate();
|
|
401
|
+
|
|
402
|
+
// Check if the only auth related option provided was authSource, if so we can remove credentials
|
|
403
|
+
if (
|
|
404
|
+
mongoOptions.credentials.password === '' &&
|
|
405
|
+
mongoOptions.credentials.username === '' &&
|
|
406
|
+
mongoOptions.credentials.mechanism === AuthMechanism.MONGODB_DEFAULT &&
|
|
407
|
+
Object.keys(mongoOptions.credentials.mechanismProperties).length === 0
|
|
408
|
+
) {
|
|
409
|
+
delete mongoOptions.credentials;
|
|
410
|
+
}
|
|
391
411
|
}
|
|
392
412
|
|
|
393
413
|
if (!mongoOptions.dbName) {
|
|
@@ -448,6 +468,34 @@ export function parseOptions(
|
|
|
448
468
|
}
|
|
449
469
|
}
|
|
450
470
|
|
|
471
|
+
if (mongoOptions.directConnection && mongoOptions.hosts.length !== 1) {
|
|
472
|
+
throw new MongoParseError('directConnection option requires exactly one host');
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
if (
|
|
476
|
+
!mongoOptions.proxyHost &&
|
|
477
|
+
(mongoOptions.proxyPort || mongoOptions.proxyUsername || mongoOptions.proxyPassword)
|
|
478
|
+
) {
|
|
479
|
+
throw new MongoParseError('Must specify proxyHost if other proxy options are passed');
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (
|
|
483
|
+
(mongoOptions.proxyUsername && !mongoOptions.proxyPassword) ||
|
|
484
|
+
(!mongoOptions.proxyUsername && mongoOptions.proxyPassword)
|
|
485
|
+
) {
|
|
486
|
+
throw new MongoParseError('Can only specify both of proxy username/password or neither');
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
const proxyOptions = ['proxyHost', 'proxyPort', 'proxyUsername', 'proxyPassword'].map(
|
|
490
|
+
key => urlOptions.get(key) ?? []
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
if (proxyOptions.some(options => options.length > 1)) {
|
|
494
|
+
throw new MongoParseError(
|
|
495
|
+
'Proxy options cannot be specified multiple times in the connection string'
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
|
|
451
499
|
return mongoOptions;
|
|
452
500
|
}
|
|
453
501
|
|
|
@@ -569,9 +617,7 @@ export const OPTIONS = {
|
|
|
569
617
|
let source = options.credentials?.source;
|
|
570
618
|
if (
|
|
571
619
|
mechanism === AuthMechanism.MONGODB_PLAIN ||
|
|
572
|
-
mechanism
|
|
573
|
-
mechanism === AuthMechanism.MONGODB_AWS ||
|
|
574
|
-
mechanism === AuthMechanism.MONGODB_X509
|
|
620
|
+
AUTH_MECHS_AUTH_SRC_EXTERNAL.has(mechanism)
|
|
575
621
|
) {
|
|
576
622
|
// some mechanisms have '$external' as the Auth Source
|
|
577
623
|
source = '$external';
|
|
@@ -590,14 +636,26 @@ export const OPTIONS = {
|
|
|
590
636
|
},
|
|
591
637
|
authMechanismProperties: {
|
|
592
638
|
target: 'credentials',
|
|
593
|
-
transform({ options, values: [
|
|
594
|
-
if (typeof
|
|
595
|
-
|
|
639
|
+
transform({ options, values: [optionValue] }): MongoCredentials {
|
|
640
|
+
if (typeof optionValue === 'string') {
|
|
641
|
+
const mechanismProperties = Object.create(null);
|
|
642
|
+
|
|
643
|
+
for (const [key, value] of entriesFromString(optionValue)) {
|
|
644
|
+
try {
|
|
645
|
+
mechanismProperties[key] = getBoolean(key, value);
|
|
646
|
+
} catch {
|
|
647
|
+
mechanismProperties[key] = value;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
return MongoCredentials.merge(options.credentials, {
|
|
652
|
+
mechanismProperties
|
|
653
|
+
});
|
|
596
654
|
}
|
|
597
|
-
if (!isRecord(
|
|
655
|
+
if (!isRecord(optionValue)) {
|
|
598
656
|
throw new MongoParseError('AuthMechanismProperties must be an object');
|
|
599
657
|
}
|
|
600
|
-
return MongoCredentials.merge(options.credentials, { mechanismProperties:
|
|
658
|
+
return MongoCredentials.merge(options.credentials, { mechanismProperties: optionValue });
|
|
601
659
|
}
|
|
602
660
|
},
|
|
603
661
|
authSource: {
|
|
@@ -688,6 +746,7 @@ export const OPTIONS = {
|
|
|
688
746
|
});
|
|
689
747
|
}
|
|
690
748
|
},
|
|
749
|
+
enableUtf8Validation: { type: 'boolean', default: true },
|
|
691
750
|
family: {
|
|
692
751
|
transform({ name, values: [value] }): 4 | 6 {
|
|
693
752
|
const transformValue = getInt(name, value);
|
|
@@ -855,6 +914,18 @@ export const OPTIONS = {
|
|
|
855
914
|
promoteValues: {
|
|
856
915
|
type: 'boolean'
|
|
857
916
|
},
|
|
917
|
+
proxyHost: {
|
|
918
|
+
type: 'string'
|
|
919
|
+
},
|
|
920
|
+
proxyPassword: {
|
|
921
|
+
type: 'string'
|
|
922
|
+
},
|
|
923
|
+
proxyPort: {
|
|
924
|
+
type: 'uint'
|
|
925
|
+
},
|
|
926
|
+
proxyUsername: {
|
|
927
|
+
type: 'string'
|
|
928
|
+
},
|
|
858
929
|
raw: {
|
|
859
930
|
default: false,
|
|
860
931
|
type: 'boolean'
|
|
@@ -913,7 +984,7 @@ export const OPTIONS = {
|
|
|
913
984
|
for (const tag of values) {
|
|
914
985
|
const readPreferenceTag: TagSet = Object.create(null);
|
|
915
986
|
if (typeof tag === 'string') {
|
|
916
|
-
for (const [k, v] of
|
|
987
|
+
for (const [k, v] of entriesFromString(tag)) {
|
|
917
988
|
readPreferenceTag[k] = v;
|
|
918
989
|
}
|
|
919
990
|
}
|