mongodb 4.1.0 → 4.1.4
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 +64 -32
- package/lib/admin.js +5 -5
- package/lib/admin.js.map +1 -1
- package/lib/bulk/common.js +93 -71
- package/lib/bulk/common.js.map +1 -1
- package/lib/change_stream.js +35 -27
- package/lib/change_stream.js.map +1 -1
- package/lib/cmap/auth/auth_provider.js +2 -2
- package/lib/cmap/auth/auth_provider.js.map +1 -1
- package/lib/cmap/auth/gssapi.js +3 -2
- package/lib/cmap/auth/gssapi.js.map +1 -1
- package/lib/cmap/auth/mongo_credentials.js +8 -7
- 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 +32 -32
- 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/scram.js +11 -8
- 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 +15 -15
- package/lib/cmap/command_monitoring_events.js.map +1 -1
- package/lib/cmap/commands.js +6 -6
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connect.js +5 -4
- package/lib/cmap/connect.js.map +1 -1
- package/lib/cmap/connection.js +27 -23
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/connection_pool.js +7 -5
- 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 +22 -9
- package/lib/cmap/wire_protocol/compression.js.map +1 -1
- package/lib/collection.js +53 -48
- package/lib/collection.js.map +1 -1
- package/lib/connection_string.js +42 -36
- package/lib/connection_string.js.map +1 -1
- package/lib/cursor/abstract_cursor.js +18 -18
- package/lib/cursor/abstract_cursor.js.map +1 -1
- package/lib/cursor/aggregation_cursor.js +56 -15
- package/lib/cursor/aggregation_cursor.js.map +1 -1
- package/lib/cursor/find_cursor.js +63 -23
- package/lib/cursor/find_cursor.js.map +1 -1
- package/lib/db.js +35 -30
- package/lib/db.js.map +1 -1
- package/lib/deps.js +8 -1
- package/lib/deps.js.map +1 -1
- package/lib/error.js +16 -54
- package/lib/error.js.map +1 -1
- package/lib/gridfs/download.js +14 -24
- package/lib/gridfs/download.js.map +1 -1
- package/lib/gridfs/index.js +5 -5
- package/lib/gridfs/index.js.map +1 -1
- package/lib/gridfs/upload.js +13 -21
- package/lib/gridfs/upload.js.map +1 -1
- package/lib/index.js +22 -2
- package/lib/index.js.map +1 -1
- package/lib/logger.js +5 -5
- package/lib/logger.js.map +1 -1
- package/lib/mongo_client.js +9 -8
- 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 +2 -2
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/bulk_write.js +1 -1
- package/lib/operations/bulk_write.js.map +1 -1
- package/lib/operations/command.js +4 -6
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/common_functions.js +2 -2
- package/lib/operations/common_functions.js.map +1 -1
- package/lib/operations/connect.js +3 -2
- 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 +1 -1
- package/lib/operations/create_collection.js.map +1 -1
- package/lib/operations/delete.js +6 -6
- package/lib/operations/delete.js.map +1 -1
- package/lib/operations/distinct.js +5 -5
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/drop.js +2 -2
- 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.map +1 -1
- package/lib/operations/execute_operation.js +10 -15
- package/lib/operations/execute_operation.js.map +1 -1
- package/lib/operations/find.js +8 -9
- package/lib/operations/find.js.map +1 -1
- package/lib/operations/find_and_modify.js +7 -7
- package/lib/operations/find_and_modify.js.map +1 -1
- package/lib/operations/indexes.js +14 -14
- package/lib/operations/indexes.js.map +1 -1
- package/lib/operations/insert.js +8 -6
- package/lib/operations/insert.js.map +1 -1
- package/lib/operations/is_capped.js +2 -1
- package/lib/operations/is_capped.js.map +1 -1
- package/lib/operations/list_collections.js +4 -4
- 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 +6 -6
- 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 +2 -1
- package/lib/operations/options_operation.js.map +1 -1
- package/lib/operations/profiling_level.js +2 -2
- 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 +2 -2
- package/lib/operations/rename.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 +2 -2
- package/lib/operations/stats.js.map +1 -1
- package/lib/operations/update.js +12 -12
- package/lib/operations/update.js.map +1 -1
- package/lib/operations/validate_collection.js +4 -4
- package/lib/operations/validate_collection.js.map +1 -1
- package/lib/sdam/monitor.js +14 -14
- package/lib/sdam/monitor.js.map +1 -1
- package/lib/sdam/server.js +16 -17
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/server_description.js +3 -3
- package/lib/sdam/server_description.js.map +1 -1
- package/lib/sdam/srv_polling.js +1 -2
- package/lib/sdam/srv_polling.js.map +1 -1
- package/lib/sdam/topology.js +21 -18
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +1 -1
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +33 -33
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js +2 -2
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +15 -37
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +384 -121
- package/mongodb.ts34.d.ts +365 -124
- package/package.json +53 -58
- package/src/bulk/common.ts +105 -61
- package/src/change_stream.ts +41 -22
- package/src/cmap/auth/auth_provider.ts +3 -3
- package/src/cmap/auth/gssapi.ts +3 -2
- package/src/cmap/auth/mongo_credentials.ts +21 -10
- package/src/cmap/auth/mongodb_aws.ts +41 -36
- package/src/cmap/auth/scram.ts +6 -4
- package/src/cmap/command_monitoring_events.ts +1 -1
- package/src/cmap/commands.ts +6 -6
- package/src/cmap/connect.ts +5 -4
- package/src/cmap/connection.ts +15 -12
- package/src/cmap/connection_pool.ts +5 -3
- package/src/cmap/message_stream.ts +2 -4
- package/src/cmap/wire_protocol/compression.ts +26 -13
- package/src/collection.ts +54 -56
- package/src/connection_string.ts +37 -26
- package/src/cursor/abstract_cursor.ts +45 -35
- package/src/cursor/aggregation_cursor.ts +30 -9
- package/src/cursor/find_cursor.ts +27 -7
- package/src/db.ts +14 -14
- package/src/deps.ts +103 -23
- package/src/error.ts +33 -66
- package/src/gridfs/download.ts +37 -27
- package/src/gridfs/index.ts +3 -3
- package/src/gridfs/upload.ts +32 -33
- package/src/index.ts +34 -3
- package/src/mongo_client.ts +9 -13
- package/src/mongo_types.ts +22 -26
- package/src/operations/command.ts +2 -5
- package/src/operations/common_functions.ts +2 -3
- package/src/operations/connect.ts +3 -2
- package/src/operations/count.ts +1 -1
- package/src/operations/count_documents.ts +1 -1
- package/src/operations/distinct.ts +1 -1
- package/src/operations/eval.ts +1 -1
- package/src/operations/execute_operation.ts +9 -10
- package/src/operations/find.ts +7 -5
- package/src/operations/indexes.ts +2 -2
- package/src/operations/insert.ts +4 -1
- package/src/operations/is_capped.ts +3 -2
- package/src/operations/list_collections.ts +3 -1
- package/src/operations/list_databases.ts +6 -1
- package/src/operations/operation.ts +0 -1
- package/src/operations/options_operation.ts +3 -2
- package/src/operations/profiling_level.ts +3 -3
- package/src/operations/set_profiling_level.ts +2 -2
- package/src/operations/validate_collection.ts +5 -5
- package/src/sdam/server.ts +6 -7
- package/src/sdam/srv_polling.ts +2 -3
- package/src/sdam/topology.ts +15 -9
- package/src/sdam/topology_description.ts +2 -2
- package/src/sessions.ts +20 -16
- package/src/transactions.ts +3 -3
- package/src/utils.ts +20 -41
- package/HISTORY.md +0 -3026
- package/lib/operations/find_one.js +0 -34
- package/lib/operations/find_one.js.map +0 -1
- package/src/operations/find_one.ts +0 -43
|
@@ -27,7 +27,7 @@ class AggregationCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
27
27
|
return this[kPipeline];
|
|
28
28
|
}
|
|
29
29
|
clone() {
|
|
30
|
-
const clonedOptions = utils_1.mergeOptions({}, this[kOptions]);
|
|
30
|
+
const clonedOptions = (0, utils_1.mergeOptions)({}, this[kOptions]);
|
|
31
31
|
delete clonedOptions.session;
|
|
32
32
|
return new AggregationCursor(this.topology, this.namespace, this[kPipeline], {
|
|
33
33
|
...clonedOptions
|
|
@@ -43,7 +43,7 @@ class AggregationCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
43
43
|
...this.cursorOptions,
|
|
44
44
|
session
|
|
45
45
|
});
|
|
46
|
-
execute_operation_1.executeOperation(this.topology, aggregateOperation, (err, response) => {
|
|
46
|
+
(0, execute_operation_1.executeOperation)(this.topology, aggregateOperation, (err, response) => {
|
|
47
47
|
if (err || response == null)
|
|
48
48
|
return callback(err);
|
|
49
49
|
// TODO: NODE-2882
|
|
@@ -55,74 +55,115 @@ class AggregationCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
55
55
|
(callback = verbosity), (verbosity = true);
|
|
56
56
|
if (verbosity == null)
|
|
57
57
|
verbosity = true;
|
|
58
|
-
return execute_operation_1.executeOperation(this.topology, new aggregate_1.AggregateOperation(this.namespace, this[kPipeline], {
|
|
58
|
+
return (0, execute_operation_1.executeOperation)(this.topology, new aggregate_1.AggregateOperation(this.namespace, this[kPipeline], {
|
|
59
59
|
...this[kOptions],
|
|
60
60
|
...this.cursorOptions,
|
|
61
61
|
explain: verbosity
|
|
62
62
|
}), callback);
|
|
63
63
|
}
|
|
64
64
|
group($group) {
|
|
65
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
65
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
66
66
|
this[kPipeline].push({ $group });
|
|
67
67
|
return this;
|
|
68
68
|
}
|
|
69
69
|
/** Add a limit stage to the aggregation pipeline */
|
|
70
70
|
limit($limit) {
|
|
71
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
71
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
72
72
|
this[kPipeline].push({ $limit });
|
|
73
73
|
return this;
|
|
74
74
|
}
|
|
75
75
|
/** Add a match stage to the aggregation pipeline */
|
|
76
76
|
match($match) {
|
|
77
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
77
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
78
78
|
this[kPipeline].push({ $match });
|
|
79
79
|
return this;
|
|
80
80
|
}
|
|
81
|
-
/** Add
|
|
81
|
+
/** Add an out stage to the aggregation pipeline */
|
|
82
82
|
out($out) {
|
|
83
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
83
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
84
84
|
this[kPipeline].push({ $out });
|
|
85
85
|
return this;
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Add a project stage to the aggregation pipeline
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* In order to strictly type this function you must provide an interface
|
|
92
|
+
* that represents the effect of your projection on the result documents.
|
|
93
|
+
*
|
|
94
|
+
* By default chaining a projection to your cursor changes the returned type to the generic {@link Document} type.
|
|
95
|
+
* You should specify a parameterized type to have assertions on your final results.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* // Best way
|
|
100
|
+
* const docs: AggregationCursor<{ a: number }> = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
101
|
+
* // Flexible way
|
|
102
|
+
* const docs: AggregationCursor<Document> = cursor.project({ _id: 0, a: true });
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* In order to strictly type this function you must provide an interface
|
|
107
|
+
* that represents the effect of your projection on the result documents.
|
|
108
|
+
*
|
|
109
|
+
* **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
|
|
110
|
+
* it **does not** return a new instance of a cursor. This means when calling project,
|
|
111
|
+
* you should always assign the result to a new variable in order to get a correctly typed cursor variable.
|
|
112
|
+
* Take note of the following example:
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const cursor: AggregationCursor<{ a: number; b: string }> = coll.aggregate([]);
|
|
117
|
+
* const projectCursor = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
118
|
+
* const aPropOnlyArray: {a: number}[] = await projectCursor.toArray();
|
|
119
|
+
*
|
|
120
|
+
* // or always use chaining and save the final cursor
|
|
121
|
+
*
|
|
122
|
+
* const cursor = coll.aggregate().project<{ a: string }>({
|
|
123
|
+
* _id: 0,
|
|
124
|
+
* a: { $convert: { input: '$a', to: 'string' }
|
|
125
|
+
* }});
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
87
128
|
project($project) {
|
|
88
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
129
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
89
130
|
this[kPipeline].push({ $project });
|
|
90
131
|
return this;
|
|
91
132
|
}
|
|
92
133
|
/** Add a lookup stage to the aggregation pipeline */
|
|
93
134
|
lookup($lookup) {
|
|
94
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
135
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
95
136
|
this[kPipeline].push({ $lookup });
|
|
96
137
|
return this;
|
|
97
138
|
}
|
|
98
139
|
/** Add a redact stage to the aggregation pipeline */
|
|
99
140
|
redact($redact) {
|
|
100
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
141
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
101
142
|
this[kPipeline].push({ $redact });
|
|
102
143
|
return this;
|
|
103
144
|
}
|
|
104
145
|
/** Add a skip stage to the aggregation pipeline */
|
|
105
146
|
skip($skip) {
|
|
106
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
147
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
107
148
|
this[kPipeline].push({ $skip });
|
|
108
149
|
return this;
|
|
109
150
|
}
|
|
110
151
|
/** Add a sort stage to the aggregation pipeline */
|
|
111
152
|
sort($sort) {
|
|
112
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
153
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
113
154
|
this[kPipeline].push({ $sort });
|
|
114
155
|
return this;
|
|
115
156
|
}
|
|
116
157
|
/** Add a unwind stage to the aggregation pipeline */
|
|
117
158
|
unwind($unwind) {
|
|
118
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
159
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
119
160
|
this[kPipeline].push({ $unwind });
|
|
120
161
|
return this;
|
|
121
162
|
}
|
|
122
163
|
// deprecated methods
|
|
123
164
|
/** @deprecated Add a geoNear stage to the aggregation pipeline */
|
|
124
165
|
geoNear($geoNear) {
|
|
125
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
166
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
126
167
|
this[kPipeline].push({ $geoNear });
|
|
127
168
|
return this;
|
|
128
169
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregation_cursor.js","sourceRoot":"","sources":["../../src/cursor/aggregation_cursor.ts"],"names":[],"mappings":";;;AAAA,uDAA+E;AAC/E,uDAAwE;AACxE,uEAAoF;AACpF,oCAAwC;
|
|
1
|
+
{"version":3,"file":"aggregation_cursor.js","sourceRoot":"","sources":["../../src/cursor/aggregation_cursor.ts"],"names":[],"mappings":";;;AAAA,uDAA+E;AAC/E,uDAAwE;AACxE,uEAAoF;AACpF,oCAAwC;AAYxC,gBAAgB;AAChB,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACrC,gBAAgB;AAChB,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAEnC;;;;;;GAMG;AACH,MAAa,iBAAsC,SAAQ,gCAAuB;IAMhF,gBAAgB;IAChB,YACE,QAAkB,EAClB,SAA2B,EAC3B,WAAuB,EAAE,EACzB,UAA4B,EAAE;QAE9B,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAEpC,IAAI,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC;IAED,KAAK;QACH,MAAM,aAAa,GAAG,IAAA,oBAAY,EAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,OAAO,aAAa,CAAC,OAAO,CAAC;QAC7B,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE;YAC3E,GAAG,aAAa;SACjB,CAAC,CAAC;IACL,CAAC;IAED,GAAG,CAAI,SAA8B;QACnC,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,CAAyB,CAAC;IACtD,CA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AC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,IAAI,CAAC,KAAa;QAChB,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,IAAI,CAAC,KAAW;QACd,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,OAA0B;QAC/B,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qBAAqB;IACrB,kEAAkE;IAClE,OAAO,CAAC,QAAkB;QACxB,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/LD,8CA+LC"}
|
|
@@ -31,11 +31,11 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
31
31
|
this[kFilter] = filter || {};
|
|
32
32
|
this[kBuiltOptions] = options;
|
|
33
33
|
if (options.sort != null) {
|
|
34
|
-
this[kBuiltOptions].sort = sort_1.formatSort(options.sort);
|
|
34
|
+
this[kBuiltOptions].sort = (0, sort_1.formatSort)(options.sort);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
clone() {
|
|
38
|
-
const clonedOptions = utils_1.mergeOptions({}, this[kBuiltOptions]);
|
|
38
|
+
const clonedOptions = (0, utils_1.mergeOptions)({}, this[kBuiltOptions]);
|
|
39
39
|
delete clonedOptions.session;
|
|
40
40
|
return new FindCursor(this.topology, this.namespace, this[kFilter], {
|
|
41
41
|
...clonedOptions
|
|
@@ -51,7 +51,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
51
51
|
...this.cursorOptions,
|
|
52
52
|
session
|
|
53
53
|
});
|
|
54
|
-
execute_operation_1.executeOperation(this.topology, findOperation, (err, response) => {
|
|
54
|
+
(0, execute_operation_1.executeOperation)(this.topology, findOperation, (err, response) => {
|
|
55
55
|
if (err || response == null)
|
|
56
56
|
return callback(err);
|
|
57
57
|
// TODO: We only need this for legacy queries that do not support `limit`, maybe
|
|
@@ -95,7 +95,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
95
95
|
if (typeof options === 'function')
|
|
96
96
|
(callback = options), (options = {});
|
|
97
97
|
options = options !== null && options !== void 0 ? options : {};
|
|
98
|
-
return execute_operation_1.executeOperation(this.topology, new count_1.CountOperation(this.namespace, this[kFilter], {
|
|
98
|
+
return (0, execute_operation_1.executeOperation)(this.topology, new count_1.CountOperation(this.namespace, this[kFilter], {
|
|
99
99
|
...this[kBuiltOptions],
|
|
100
100
|
...this.cursorOptions,
|
|
101
101
|
...options
|
|
@@ -106,7 +106,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
106
106
|
(callback = verbosity), (verbosity = true);
|
|
107
107
|
if (verbosity == null)
|
|
108
108
|
verbosity = true;
|
|
109
|
-
return execute_operation_1.executeOperation(this.topology, new find_1.FindOperation(undefined, this.namespace, this[kFilter], {
|
|
109
|
+
return (0, execute_operation_1.executeOperation)(this.topology, new find_1.FindOperation(undefined, this.namespace, this[kFilter], {
|
|
110
110
|
...this[kBuiltOptions],
|
|
111
111
|
...this.cursorOptions,
|
|
112
112
|
explain: verbosity
|
|
@@ -114,7 +114,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
114
114
|
}
|
|
115
115
|
/** Set the cursor query */
|
|
116
116
|
filter(filter) {
|
|
117
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
117
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
118
118
|
this[kFilter] = filter;
|
|
119
119
|
return this;
|
|
120
120
|
}
|
|
@@ -124,7 +124,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
124
124
|
* @param hint - If specified, then the query system will only consider plans using the hinted index.
|
|
125
125
|
*/
|
|
126
126
|
hint(hint) {
|
|
127
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
127
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
128
128
|
this[kBuiltOptions].hint = hint;
|
|
129
129
|
return this;
|
|
130
130
|
}
|
|
@@ -134,7 +134,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
134
134
|
* @param min - Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.
|
|
135
135
|
*/
|
|
136
136
|
min(min) {
|
|
137
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
137
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
138
138
|
this[kBuiltOptions].min = min;
|
|
139
139
|
return this;
|
|
140
140
|
}
|
|
@@ -144,7 +144,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
144
144
|
* @param max - Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order.
|
|
145
145
|
*/
|
|
146
146
|
max(max) {
|
|
147
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
147
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
148
148
|
this[kBuiltOptions].max = max;
|
|
149
149
|
return this;
|
|
150
150
|
}
|
|
@@ -156,7 +156,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
156
156
|
* @param value - the returnKey value.
|
|
157
157
|
*/
|
|
158
158
|
returnKey(value) {
|
|
159
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
159
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
160
160
|
this[kBuiltOptions].returnKey = value;
|
|
161
161
|
return this;
|
|
162
162
|
}
|
|
@@ -166,7 +166,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
166
166
|
* @param value - The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find.
|
|
167
167
|
*/
|
|
168
168
|
showRecordId(value) {
|
|
169
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
169
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
170
170
|
this[kBuiltOptions].showRecordId = value;
|
|
171
171
|
return this;
|
|
172
172
|
}
|
|
@@ -177,7 +177,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
177
177
|
* @param value - The modifier value.
|
|
178
178
|
*/
|
|
179
179
|
addQueryModifier(name, value) {
|
|
180
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
180
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
181
181
|
if (name[0] !== '$') {
|
|
182
182
|
throw new error_1.MongoInvalidArgumentError(`${name} is not a valid query modifier`);
|
|
183
183
|
}
|
|
@@ -204,7 +204,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
204
204
|
this[kBuiltOptions].min = value;
|
|
205
205
|
break;
|
|
206
206
|
case 'orderby':
|
|
207
|
-
this[kBuiltOptions].sort = sort_1.formatSort(value);
|
|
207
|
+
this[kBuiltOptions].sort = (0, sort_1.formatSort)(value);
|
|
208
208
|
break;
|
|
209
209
|
case 'query':
|
|
210
210
|
this[kFilter] = value;
|
|
@@ -226,7 +226,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
226
226
|
* @param value - The comment attached to this query.
|
|
227
227
|
*/
|
|
228
228
|
comment(value) {
|
|
229
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
229
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
230
230
|
this[kBuiltOptions].comment = value;
|
|
231
231
|
return this;
|
|
232
232
|
}
|
|
@@ -236,7 +236,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
236
236
|
* @param value - Number of milliseconds to wait before aborting the tailed query.
|
|
237
237
|
*/
|
|
238
238
|
maxAwaitTimeMS(value) {
|
|
239
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
239
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
240
240
|
if (typeof value !== 'number') {
|
|
241
241
|
throw new error_1.MongoInvalidArgumentError('Argument for maxAwaitTimeMS must be a number');
|
|
242
242
|
}
|
|
@@ -249,15 +249,55 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
249
249
|
* @param value - Number of milliseconds to wait before aborting the query.
|
|
250
250
|
*/
|
|
251
251
|
maxTimeMS(value) {
|
|
252
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
252
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
253
253
|
if (typeof value !== 'number') {
|
|
254
254
|
throw new error_1.MongoInvalidArgumentError('Argument for maxTimeMS must be a number');
|
|
255
255
|
}
|
|
256
256
|
this[kBuiltOptions].maxTimeMS = value;
|
|
257
257
|
return this;
|
|
258
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Add a project stage to the aggregation pipeline
|
|
261
|
+
*
|
|
262
|
+
* @remarks
|
|
263
|
+
* In order to strictly type this function you must provide an interface
|
|
264
|
+
* that represents the effect of your projection on the result documents.
|
|
265
|
+
*
|
|
266
|
+
* By default chaining a projection to your cursor changes the returned type to the generic
|
|
267
|
+
* {@link Document} type.
|
|
268
|
+
* You should specify a parameterized type to have assertions on your final results.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* // Best way
|
|
273
|
+
* const docs: FindCursor<{ a: number }> = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
274
|
+
* // Flexible way
|
|
275
|
+
* const docs: FindCursor<Document> = cursor.project({ _id: 0, a: true });
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @remarks
|
|
279
|
+
*
|
|
280
|
+
* **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
|
|
281
|
+
* it **does not** return a new instance of a cursor. This means when calling project,
|
|
282
|
+
* you should always assign the result to a new variable in order to get a correctly typed cursor variable.
|
|
283
|
+
* Take note of the following example:
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* const cursor: FindCursor<{ a: number; b: string }> = coll.find();
|
|
288
|
+
* const projectCursor = cursor.project<{ a: number }>({ _id: 0, a: true });
|
|
289
|
+
* const aPropOnlyArray: {a: number}[] = await projectCursor.toArray();
|
|
290
|
+
*
|
|
291
|
+
* // or always use chaining and save the final cursor
|
|
292
|
+
*
|
|
293
|
+
* const cursor = coll.find().project<{ a: string }>({
|
|
294
|
+
* _id: 0,
|
|
295
|
+
* a: { $convert: { input: '$a', to: 'string' }
|
|
296
|
+
* }});
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
259
299
|
project(value) {
|
|
260
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
300
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
261
301
|
this[kBuiltOptions].projection = value;
|
|
262
302
|
return this;
|
|
263
303
|
}
|
|
@@ -268,11 +308,11 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
268
308
|
* @param direction - The direction of the sorting (1 or -1).
|
|
269
309
|
*/
|
|
270
310
|
sort(sort, direction) {
|
|
271
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
311
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
272
312
|
if (this[kBuiltOptions].tailable) {
|
|
273
313
|
throw new error_1.MongoTailableCursorError('Tailable cursor does not support sorting');
|
|
274
314
|
}
|
|
275
|
-
this[kBuiltOptions].sort = sort_1.formatSort(sort, direction);
|
|
315
|
+
this[kBuiltOptions].sort = (0, sort_1.formatSort)(sort, direction);
|
|
276
316
|
return this;
|
|
277
317
|
}
|
|
278
318
|
/**
|
|
@@ -282,7 +322,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
282
322
|
* {@link https://docs.mongodb.com/manual/reference/command/find/#find-cmd-allowdiskuse | find command allowDiskUse documentation}
|
|
283
323
|
*/
|
|
284
324
|
allowDiskUse() {
|
|
285
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
325
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
286
326
|
if (!this[kBuiltOptions].sort) {
|
|
287
327
|
throw new error_1.MongoInvalidArgumentError('Option "allowDiskUse" requires a sort specification');
|
|
288
328
|
}
|
|
@@ -295,7 +335,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
295
335
|
* @param value - The cursor collation options (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields).
|
|
296
336
|
*/
|
|
297
337
|
collation(value) {
|
|
298
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
338
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
299
339
|
this[kBuiltOptions].collation = value;
|
|
300
340
|
return this;
|
|
301
341
|
}
|
|
@@ -305,7 +345,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
305
345
|
* @param value - The limit for the cursor query.
|
|
306
346
|
*/
|
|
307
347
|
limit(value) {
|
|
308
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
348
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
309
349
|
if (this[kBuiltOptions].tailable) {
|
|
310
350
|
throw new error_1.MongoTailableCursorError('Tailable cursor does not support limit');
|
|
311
351
|
}
|
|
@@ -321,7 +361,7 @@ class FindCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
321
361
|
* @param value - The skip for the cursor query.
|
|
322
362
|
*/
|
|
323
363
|
skip(value) {
|
|
324
|
-
abstract_cursor_1.assertUninitialized(this);
|
|
364
|
+
(0, abstract_cursor_1.assertUninitialized)(this);
|
|
325
365
|
if (this[kBuiltOptions].tailable) {
|
|
326
366
|
throw new error_1.MongoTailableCursorError('Tailable cursor does not support skip');
|
|
327
367
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find_cursor.js","sourceRoot":"","sources":["../../src/cursor/find_cursor.ts"],"names":[],"mappings":";;;AACA,oCAA+E;AAE/E,+CAAmE;AACnE,uEAAoF;AACpF,6CAAgE;AAChE,oCAAwC;AAKxC,kCAA0D;AAE1D,uDAAwE;
|
|
1
|
+
{"version":3,"file":"find_cursor.js","sourceRoot":"","sources":["../../src/cursor/find_cursor.ts"],"names":[],"mappings":";;;AACA,oCAA+E;AAE/E,+CAAmE;AACnE,uEAAoF;AACpF,6CAAgE;AAChE,oCAAwC;AAKxC,kCAA0D;AAE1D,uDAAwE;AAExE,gBAAgB;AAChB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,gBAAgB;AAChB,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAC3C,gBAAgB;AAChB,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE7C,uCAAuC;AAC1B,QAAA,KAAK,GAAG;IACnB,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,SAAS;IACT,SAAS;CACD,CAAC;AAEX,cAAc;AACd,MAAa,UAA+B,SAAQ,gCAAuB;IAQzE,gBAAgB;IAChB,YACE,QAAkB,EAClB,SAA2B,EAC3B,MAA4B,EAC5B,UAAuB,EAAE;QAEzB,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAEpC,IAAI,CAAC,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC;QA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AY,GAAG,IAAI,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,KAAuB;QAC/B,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAa;QACjB,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;YAChC,MAAM,IAAI,gCAAwB,CAAC,wCAAwC,CAAC,CAAC;SAC9E;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,IAAI,iCAAyB,CAAC,uCAAuC,CAAC,CAAC;SAC9E;QAED,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAa;QAChB,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;YAChC,MAAM,IAAI,gCAAwB,CAAC,uCAAuC,CAAC,CAAC;SAC7E;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,IAAI,iCAAyB,CAAC,sCAAsC,CAAC,CAAC;SAC7E;QAED,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9aD,gCA8aC"}
|
package/lib/db.js
CHANGED
|
@@ -81,7 +81,7 @@ class Db {
|
|
|
81
81
|
var _a;
|
|
82
82
|
options = options !== null && options !== void 0 ? options : {};
|
|
83
83
|
// Filter the options
|
|
84
|
-
options = utils_1.filterOptions(options, DB_OPTIONS_ALLOW_LIST);
|
|
84
|
+
options = (0, utils_1.filterOptions)(options, DB_OPTIONS_ALLOW_LIST);
|
|
85
85
|
// Ensure we have a valid db name
|
|
86
86
|
validateDatabaseName(databaseName);
|
|
87
87
|
// Internal state of the db object
|
|
@@ -95,7 +95,7 @@ class Db {
|
|
|
95
95
|
// Unpack read preference
|
|
96
96
|
readPreference: read_preference_1.ReadPreference.fromOptions(options),
|
|
97
97
|
// Merge bson options
|
|
98
|
-
bsonOptions: bson_1.resolveBSONOptions(options, client),
|
|
98
|
+
bsonOptions: (0, bson_1.resolveBSONOptions)(options, client),
|
|
99
99
|
// Set up the primary key factory or fallback to ObjectId
|
|
100
100
|
pkFactory: (_a = options === null || options === void 0 ? void 0 : options.pkFactory) !== null && _a !== void 0 ? _a : utils_1.DEFAULT_PK_FACTORY,
|
|
101
101
|
// ReadConcern
|
|
@@ -143,13 +143,13 @@ class Db {
|
|
|
143
143
|
createCollection(name, options, callback) {
|
|
144
144
|
if (typeof options === 'function')
|
|
145
145
|
(callback = options), (options = {});
|
|
146
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new create_collection_1.CreateCollectionOperation(this, name, utils_1.resolveOptions(this, options)), callback);
|
|
146
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new create_collection_1.CreateCollectionOperation(this, name, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
147
147
|
}
|
|
148
148
|
command(command, options, callback) {
|
|
149
149
|
if (typeof options === 'function')
|
|
150
150
|
(callback = options), (options = {});
|
|
151
151
|
// Intentionally, we do not inherit options from parent for this operation.
|
|
152
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new run_command_1.RunCommandOperation(this, command, options !== null && options !== void 0 ? options : {}), callback);
|
|
152
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new run_command_1.RunCommandOperation(this, command, options !== null && options !== void 0 ? options : {}), callback);
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
155
|
* Execute an aggregation framework pipeline against the database, needs MongoDB \>= 3.6
|
|
@@ -167,30 +167,32 @@ class Db {
|
|
|
167
167
|
if (typeof options === 'function') {
|
|
168
168
|
throw new error_1.MongoInvalidArgumentError('Argument "options" must not be function');
|
|
169
169
|
}
|
|
170
|
-
return new aggregation_cursor_1.AggregationCursor(utils_1.getTopology(this), this.s.namespace, pipeline, utils_1.resolveOptions(this, options));
|
|
170
|
+
return new aggregation_cursor_1.AggregationCursor((0, utils_1.getTopology)(this), this.s.namespace, pipeline, (0, utils_1.resolveOptions)(this, options));
|
|
171
171
|
}
|
|
172
172
|
/** Return the Admin db instance */
|
|
173
173
|
admin() {
|
|
174
174
|
return new admin_1.Admin(this);
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Returns a reference to a MongoDB Collection. If it does not exist it will be created implicitly.
|
|
178
|
+
*
|
|
179
|
+
* @param name - the collection name we wish to access.
|
|
180
|
+
* @returns return the new Collection instance
|
|
181
|
+
*/
|
|
182
|
+
collection(name, options = {}) {
|
|
183
|
+
if (typeof options === 'function') {
|
|
184
|
+
throw new error_1.MongoInvalidArgumentError('The callback form of this helper has been removed.');
|
|
183
185
|
}
|
|
184
|
-
const finalOptions = utils_1.resolveOptions(this, options);
|
|
186
|
+
const finalOptions = (0, utils_1.resolveOptions)(this, options);
|
|
185
187
|
return new collection_1.Collection(this, name, finalOptions);
|
|
186
188
|
}
|
|
187
189
|
stats(options, callback) {
|
|
188
190
|
if (typeof options === 'function')
|
|
189
191
|
(callback = options), (options = {});
|
|
190
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new stats_1.DbStatsOperation(this, utils_1.resolveOptions(this, options)), callback);
|
|
192
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new stats_1.DbStatsOperation(this, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
191
193
|
}
|
|
192
194
|
listCollections(filter = {}, options = {}) {
|
|
193
|
-
return new list_collections_1.ListCollectionsCursor(this, filter, utils_1.resolveOptions(this, options));
|
|
195
|
+
return new list_collections_1.ListCollectionsCursor(this, filter, (0, utils_1.resolveOptions)(this, options));
|
|
194
196
|
}
|
|
195
197
|
renameCollection(fromCollection, toCollection, options, callback) {
|
|
196
198
|
if (typeof options === 'function')
|
|
@@ -199,27 +201,27 @@ class Db {
|
|
|
199
201
|
options = { ...options, readPreference: read_preference_1.ReadPreference.PRIMARY };
|
|
200
202
|
// Add return new collection
|
|
201
203
|
options.new_collection = true;
|
|
202
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new rename_1.RenameOperation(this.collection(fromCollection), toCollection, options), callback);
|
|
204
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new rename_1.RenameOperation(this.collection(fromCollection), toCollection, options), callback);
|
|
203
205
|
}
|
|
204
206
|
dropCollection(name, options, callback) {
|
|
205
207
|
if (typeof options === 'function')
|
|
206
208
|
(callback = options), (options = {});
|
|
207
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new drop_1.DropCollectionOperation(this, name, utils_1.resolveOptions(this, options)), callback);
|
|
209
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new drop_1.DropCollectionOperation(this, name, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
208
210
|
}
|
|
209
211
|
dropDatabase(options, callback) {
|
|
210
212
|
if (typeof options === 'function')
|
|
211
213
|
(callback = options), (options = {});
|
|
212
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new drop_1.DropDatabaseOperation(this, utils_1.resolveOptions(this, options)), callback);
|
|
214
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new drop_1.DropDatabaseOperation(this, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
213
215
|
}
|
|
214
216
|
collections(options, callback) {
|
|
215
217
|
if (typeof options === 'function')
|
|
216
218
|
(callback = options), (options = {});
|
|
217
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new collections_1.CollectionsOperation(this, utils_1.resolveOptions(this, options)), callback);
|
|
219
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new collections_1.CollectionsOperation(this, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
218
220
|
}
|
|
219
221
|
createIndex(name, indexSpec, options, callback) {
|
|
220
222
|
if (typeof options === 'function')
|
|
221
223
|
(callback = options), (options = {});
|
|
222
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new indexes_1.CreateIndexOperation(this, name, indexSpec, utils_1.resolveOptions(this, options)), callback);
|
|
224
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new indexes_1.CreateIndexOperation(this, name, indexSpec, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
223
225
|
}
|
|
224
226
|
addUser(username, password, options, callback) {
|
|
225
227
|
if (typeof password === 'function') {
|
|
@@ -237,31 +239,34 @@ class Db {
|
|
|
237
239
|
if (typeof options === 'function')
|
|
238
240
|
(callback = options), (options = {});
|
|
239
241
|
}
|
|
240
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new add_user_1.AddUserOperation(this, username, password, utils_1.resolveOptions(this, options)), callback);
|
|
242
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new add_user_1.AddUserOperation(this, username, password, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
241
243
|
}
|
|
242
244
|
removeUser(username, options, callback) {
|
|
243
245
|
if (typeof options === 'function')
|
|
244
246
|
(callback = options), (options = {});
|
|
245
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new remove_user_1.RemoveUserOperation(this, username, utils_1.resolveOptions(this, options)), callback);
|
|
247
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new remove_user_1.RemoveUserOperation(this, username, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
246
248
|
}
|
|
247
249
|
setProfilingLevel(level, options, callback) {
|
|
248
250
|
if (typeof options === 'function')
|
|
249
251
|
(callback = options), (options = {});
|
|
250
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new set_profiling_level_1.SetProfilingLevelOperation(this, level, utils_1.resolveOptions(this, options)), callback);
|
|
252
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new set_profiling_level_1.SetProfilingLevelOperation(this, level, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
251
253
|
}
|
|
252
254
|
profilingLevel(options, callback) {
|
|
253
255
|
if (typeof options === 'function')
|
|
254
256
|
(callback = options), (options = {});
|
|
255
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new profiling_level_1.ProfilingLevelOperation(this, utils_1.resolveOptions(this, options)), callback);
|
|
257
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new profiling_level_1.ProfilingLevelOperation(this, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
256
258
|
}
|
|
257
259
|
indexInformation(name, options, callback) {
|
|
258
260
|
if (typeof options === 'function')
|
|
259
261
|
(callback = options), (options = {});
|
|
260
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this), new indexes_1.IndexInformationOperation(this, name, utils_1.resolveOptions(this, options)), callback);
|
|
262
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this), new indexes_1.IndexInformationOperation(this, name, (0, utils_1.resolveOptions)(this, options)), callback);
|
|
261
263
|
}
|
|
262
|
-
/**
|
|
264
|
+
/**
|
|
265
|
+
* Unref all sockets
|
|
266
|
+
* @deprecated This function is deprecated and will be removed in the next major version.
|
|
267
|
+
*/
|
|
263
268
|
unref() {
|
|
264
|
-
utils_1.getTopology(this).unref();
|
|
269
|
+
(0, utils_1.getTopology)(this).unref();
|
|
265
270
|
}
|
|
266
271
|
/**
|
|
267
272
|
* Create a new Change Stream, watching for new changes (insertions, updates,
|
|
@@ -277,7 +282,7 @@ class Db {
|
|
|
277
282
|
options = pipeline;
|
|
278
283
|
pipeline = [];
|
|
279
284
|
}
|
|
280
|
-
return new change_stream_1.ChangeStream(this, pipeline, utils_1.resolveOptions(this, options));
|
|
285
|
+
return new change_stream_1.ChangeStream(this, pipeline, (0, utils_1.resolveOptions)(this, options));
|
|
281
286
|
}
|
|
282
287
|
/** Return the db logger */
|
|
283
288
|
getLogger() {
|
|
@@ -294,6 +299,7 @@ Db.SYSTEM_PROFILE_COLLECTION = CONSTANTS.SYSTEM_PROFILE_COLLECTION;
|
|
|
294
299
|
Db.SYSTEM_USER_COLLECTION = CONSTANTS.SYSTEM_USER_COLLECTION;
|
|
295
300
|
Db.SYSTEM_COMMAND_COLLECTION = CONSTANTS.SYSTEM_COMMAND_COLLECTION;
|
|
296
301
|
Db.SYSTEM_JS_COLLECTION = CONSTANTS.SYSTEM_JS_COLLECTION;
|
|
302
|
+
// TODO(NODE-3484): Refactor into MongoDBNamespace
|
|
297
303
|
// Validate the database name
|
|
298
304
|
function validateDatabaseName(databaseName) {
|
|
299
305
|
if (typeof databaseName !== 'string')
|
|
@@ -305,8 +311,7 @@ function validateDatabaseName(databaseName) {
|
|
|
305
311
|
const invalidChars = [' ', '.', '$', '/', '\\'];
|
|
306
312
|
for (let i = 0; i < invalidChars.length; i++) {
|
|
307
313
|
if (databaseName.indexOf(invalidChars[i]) !== -1)
|
|
308
|
-
|
|
309
|
-
throw new error_1.MongoDriverError(`database names cannot contain the character '${invalidChars[i]}'`);
|
|
314
|
+
throw new error_1.MongoAPIError(`database names cannot contain the character '${invalidChars[i]}'`);
|
|
310
315
|
}
|
|
311
316
|
}
|
|
312
317
|
//# sourceMappingURL=db.js.map
|