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
package/README.md
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
The official [MongoDB](https://www.mongodb.com/) driver for Node.js.
|
|
4
4
|
|
|
5
|
-
**Upgrading to version 4? Take a look at our [upgrade guide here](https://github.com/mongodb/node-mongodb-native/blob/4.
|
|
5
|
+
**Upgrading to version 4? Take a look at our [upgrade guide here](https://github.com/mongodb/node-mongodb-native/blob/4.1/docs/CHANGES_4.0.0.md)!**
|
|
6
6
|
|
|
7
7
|
## Quick Links
|
|
8
8
|
|
|
9
9
|
| what | where |
|
|
10
10
|
| ------------- | ------------------------------------------------------------------------------------------------------ |
|
|
11
11
|
| documentation | [docs.mongodb.com/drivers/node](https://docs.mongodb.com/drivers/node) |
|
|
12
|
-
| api-doc | [mongodb.github.io/node-mongodb-native/4.
|
|
12
|
+
| api-doc | [mongodb.github.io/node-mongodb-native/4.1/](https://mongodb.github.io/node-mongodb-native/4.1/) |
|
|
13
13
|
| npm package | [www.npmjs.com/package/mongodb](https://www.npmjs.com/package/mongodb) |
|
|
14
14
|
| source | [github.com/mongodb/node-mongodb-native](https://github.com/mongodb/node-mongodb-native) |
|
|
15
15
|
| mongodb | [www.mongodb.com](https://www.mongodb.com) |
|
|
16
|
-
| changelog | [HISTORY.md](https://github.com/mongodb/node-mongodb-native/blob/4.
|
|
17
|
-
| upgrade to v4 | [docs/CHANGES_4.0.0.md](https://github.com/mongodb/node-mongodb-native/blob/4.
|
|
16
|
+
| changelog | [HISTORY.md](https://github.com/mongodb/node-mongodb-native/blob/4.1/HISTORY.md) |
|
|
17
|
+
| upgrade to v4 | [docs/CHANGES_4.0.0.md](https://github.com/mongodb/node-mongodb-native/blob/4.1/docs/CHANGES_4.0.0.md) |
|
|
18
18
|
|
|
19
19
|
### Bugs / Feature Requests
|
|
20
20
|
|
|
@@ -34,14 +34,14 @@ For issues with, questions about, or feedback for the Node.js driver, please loo
|
|
|
34
34
|
|
|
35
35
|
### Change Log
|
|
36
36
|
|
|
37
|
-
Change history can be found in [`HISTORY.md`](https://github.com/mongodb/node-mongodb-native/blob/4.
|
|
37
|
+
Change history can be found in [`HISTORY.md`](https://github.com/mongodb/node-mongodb-native/blob/4.1/HISTORY.md).
|
|
38
38
|
|
|
39
39
|
### Compatibility
|
|
40
40
|
|
|
41
41
|
For version compatibility matrices, please refer to the following links:
|
|
42
42
|
|
|
43
|
-
- [MongoDB](https://docs.mongodb.com/drivers/node/compatibility
|
|
44
|
-
- [NodeJS](https://docs.mongodb.com/drivers/node/compatibility
|
|
43
|
+
- [MongoDB](https://docs.mongodb.com/drivers/node/current/compatibility/#mongodb-compatibility)
|
|
44
|
+
- [NodeJS](https://docs.mongodb.com/drivers/node/current/compatibility/#language-compatibility)
|
|
45
45
|
|
|
46
46
|
#### Typescript Version
|
|
47
47
|
|
|
@@ -51,7 +51,7 @@ If you run into any unexpected compiler failures please let us know and we will
|
|
|
51
51
|
|
|
52
52
|
## Installation
|
|
53
53
|
|
|
54
|
-
The recommended way to get started using the Node.js 4.
|
|
54
|
+
The recommended way to get started using the Node.js 4.x driver is by using the `npm` (Node Package Manager) to install the dependency in your project.
|
|
55
55
|
|
|
56
56
|
After you've created your own project using `npm init`, you can run:
|
|
57
57
|
|
|
@@ -63,6 +63,12 @@ yarn add mongodb
|
|
|
63
63
|
|
|
64
64
|
This will download the MongoDB driver and add a dependency entry in your `package.json` file.
|
|
65
65
|
|
|
66
|
+
If you are a Typescript user, you will need the Node.js type definitions to use the driver's definitions:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npm install -D @types/node
|
|
70
|
+
```
|
|
71
|
+
|
|
66
72
|
## Troubleshooting
|
|
67
73
|
|
|
68
74
|
The MongoDB driver depends on several other packages. These are:
|
|
@@ -72,7 +78,7 @@ The MongoDB driver depends on several other packages. These are:
|
|
|
72
78
|
- [kerberos](https://github.com/mongodb-js/kerberos)
|
|
73
79
|
- [mongodb-client-encryption](https://github.com/mongodb/libmongocrypt#readme)
|
|
74
80
|
|
|
75
|
-
Some of these packages include native C++ extensions, consult the [trouble shooting guide here](https://github.com/mongodb/node-mongodb-native/blob/4.
|
|
81
|
+
Some of these packages include native C++ extensions, consult the [trouble shooting guide here](https://github.com/mongodb/node-mongodb-native/blob/4.1/docs/native-extensions.md) if you run into issues.
|
|
76
82
|
|
|
77
83
|
## Quick Start
|
|
78
84
|
|
|
@@ -126,33 +132,33 @@ Add code to connect to the server and the database **myProject**:
|
|
|
126
132
|
> if a callback is provided a Promise will not be returned.
|
|
127
133
|
|
|
128
134
|
```js
|
|
129
|
-
const { MongoClient } = require('mongodb')
|
|
135
|
+
const { MongoClient } = require('mongodb');
|
|
130
136
|
// or as an es module:
|
|
131
137
|
// import { MongoClient } from 'mongodb'
|
|
132
138
|
|
|
133
139
|
// Connection URL
|
|
134
|
-
const url = 'mongodb://localhost:27017'
|
|
135
|
-
const client = new MongoClient(url)
|
|
140
|
+
const url = 'mongodb://localhost:27017';
|
|
141
|
+
const client = new MongoClient(url);
|
|
136
142
|
|
|
137
143
|
// Database Name
|
|
138
|
-
const dbName = 'myProject'
|
|
144
|
+
const dbName = 'myProject';
|
|
139
145
|
|
|
140
146
|
async function main() {
|
|
141
147
|
// Use connect method to connect to the server
|
|
142
|
-
await client.connect()
|
|
143
|
-
console.log('Connected successfully to server')
|
|
144
|
-
const db = client.db(dbName)
|
|
145
|
-
const collection = db.collection('documents')
|
|
148
|
+
await client.connect();
|
|
149
|
+
console.log('Connected successfully to server');
|
|
150
|
+
const db = client.db(dbName);
|
|
151
|
+
const collection = db.collection('documents');
|
|
146
152
|
|
|
147
153
|
// the following code examples can be pasted here...
|
|
148
154
|
|
|
149
|
-
return 'done.'
|
|
155
|
+
return 'done.';
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
main()
|
|
153
159
|
.then(console.log)
|
|
154
160
|
.catch(console.error)
|
|
155
|
-
.finally(() => client.close())
|
|
161
|
+
.finally(() => client.close());
|
|
156
162
|
```
|
|
157
163
|
|
|
158
164
|
Run your app from the command line with:
|
|
@@ -169,8 +175,8 @@ Add to **app.js** the following function which uses the **insertMany**
|
|
|
169
175
|
method to add three documents to the **documents** collection.
|
|
170
176
|
|
|
171
177
|
```js
|
|
172
|
-
const insertResult = await collection.insertMany([{ a: 1 }, { a: 2 }, { a: 3 }])
|
|
173
|
-
console.log('Inserted documents =>', insertResult)
|
|
178
|
+
const insertResult = await collection.insertMany([{ a: 1 }, { a: 2 }, { a: 3 }]);
|
|
179
|
+
console.log('Inserted documents =>', insertResult);
|
|
174
180
|
```
|
|
175
181
|
|
|
176
182
|
The **insertMany** command returns an object with information about the insert operations.
|
|
@@ -180,8 +186,8 @@ The **insertMany** command returns an object with information about the insert o
|
|
|
180
186
|
Add a query that returns all the documents.
|
|
181
187
|
|
|
182
188
|
```js
|
|
183
|
-
const findResult = await collection.find({}).toArray()
|
|
184
|
-
console.log('Found documents =>', findResult)
|
|
189
|
+
const findResult = await collection.find({}).toArray();
|
|
190
|
+
console.log('Found documents =>', findResult);
|
|
185
191
|
```
|
|
186
192
|
|
|
187
193
|
This query returns all the documents in the **documents** collection.
|
|
@@ -192,8 +198,8 @@ If you add this below the insertMany example you'll see the document's you've in
|
|
|
192
198
|
Add a query filter to find only documents which meet the query criteria.
|
|
193
199
|
|
|
194
200
|
```js
|
|
195
|
-
const filteredDocs = await collection.find({ a: 3 }).toArray()
|
|
196
|
-
console.log('Found documents filtered by { a: 3 } =>', filteredDocs)
|
|
201
|
+
const filteredDocs = await collection.find({ a: 3 }).toArray();
|
|
202
|
+
console.log('Found documents filtered by { a: 3 } =>', filteredDocs);
|
|
197
203
|
```
|
|
198
204
|
|
|
199
205
|
Only the documents which match `'a' : 3` should be returned.
|
|
@@ -203,8 +209,8 @@ Only the documents which match `'a' : 3` should be returned.
|
|
|
203
209
|
The following operation updates a document in the **documents** collection.
|
|
204
210
|
|
|
205
211
|
```js
|
|
206
|
-
const updateResult = await collection.updateOne({ a: 3 }, { $set: { b: 1 } })
|
|
207
|
-
console.log('Updated documents =>', updateResult)
|
|
212
|
+
const updateResult = await collection.updateOne({ a: 3 }, { $set: { b: 1 } });
|
|
213
|
+
console.log('Updated documents =>', updateResult);
|
|
208
214
|
```
|
|
209
215
|
|
|
210
216
|
The method updates the first document where the field **a** is equal to **3** by adding a new field **b** to the document set to **1**. `updateResult` contains information about whether there was a matching document to update or not.
|
|
@@ -214,8 +220,8 @@ The method updates the first document where the field **a** is equal to **3** by
|
|
|
214
220
|
Remove the document where the field **a** is equal to **3**.
|
|
215
221
|
|
|
216
222
|
```js
|
|
217
|
-
const deleteResult = await collection.deleteMany({ a: 3 })
|
|
218
|
-
console.log('Deleted documents =>', deleteResult)
|
|
223
|
+
const deleteResult = await collection.deleteMany({ a: 3 });
|
|
224
|
+
console.log('Deleted documents =>', deleteResult);
|
|
219
225
|
```
|
|
220
226
|
|
|
221
227
|
### Index a Collection
|
|
@@ -225,12 +231,38 @@ performance. The following function creates an index on the **a** field in the
|
|
|
225
231
|
**documents** collection.
|
|
226
232
|
|
|
227
233
|
```js
|
|
228
|
-
const indexName = await collection.createIndex({ a: 1 })
|
|
229
|
-
console.log('index name =', indexName)
|
|
234
|
+
const indexName = await collection.createIndex({ a: 1 });
|
|
235
|
+
console.log('index name =', indexName);
|
|
230
236
|
```
|
|
231
237
|
|
|
232
238
|
For more detailed information, see the [indexing strategies page](https://docs.mongodb.com/manual/applications/indexes/).
|
|
233
239
|
|
|
240
|
+
## Error Handling
|
|
241
|
+
|
|
242
|
+
If you need to filter certain errors from our driver we have a helpful tree of errors described in [docs/errors.md](https://github.com/mongodb/node-mongodb-native/blob/4.1/docs/errors.md).
|
|
243
|
+
|
|
244
|
+
It is our recommendation to use `instanceof` checks on errors and to avoid relying on parsing `error.message` and `error.name` strings in your code.
|
|
245
|
+
We guarantee `instanceof` checks will pass according to semver guidelines, but errors may be sub-classed or their messages may change at any time, even patch releases, as we see fit to increase the helpfulness of the errors.
|
|
246
|
+
|
|
247
|
+
Any new errors we add to the driver will directly extend an existing error class and no existing error will be moved to a different parent class outside of a major release.
|
|
248
|
+
This means `instanceof` will always be able to accurately capture the errors that our driver throws (or returns in a callback).
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
const client = new MongoClient(url);
|
|
252
|
+
await client.connect();
|
|
253
|
+
const collection = client.db().collection('collection');
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
await collection.insertOne({ _id: 1 });
|
|
257
|
+
await collection.insertOne({ _id: 1 }); // duplicate key error
|
|
258
|
+
} catch (error) {
|
|
259
|
+
if (error instanceof MongoServerError) {
|
|
260
|
+
console.log(`Error worth logging: ${error}`); // special case for some reason
|
|
261
|
+
}
|
|
262
|
+
throw error; // still want to crash
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
234
266
|
## Next Steps
|
|
235
267
|
|
|
236
268
|
- [MongoDB Documentation](https://docs.mongodb.com/manual/)
|
|
@@ -243,4 +275,4 @@ For more detailed information, see the [indexing strategies page](https://docs.m
|
|
|
243
275
|
[Apache 2.0](LICENSE.md)
|
|
244
276
|
|
|
245
277
|
© 2009-2012 Christian Amor Kvalheim
|
|
246
|
-
© 2012-present MongoDB [Contributors](https://github.com/mongodb/node-mongodb-native/blob/4.
|
|
278
|
+
© 2012-present MongoDB [Contributors](https://github.com/mongodb/node-mongodb-native/blob/4.1/CONTRIBUTORS.md)
|
package/lib/admin.js
CHANGED
|
@@ -50,7 +50,7 @@ class Admin {
|
|
|
50
50
|
if (typeof options === 'function')
|
|
51
51
|
(callback = options), (options = {});
|
|
52
52
|
options = Object.assign({ dbName: 'admin' }, options);
|
|
53
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this.s.db), new run_command_1.RunCommandOperation(this.s.db, command, options), callback);
|
|
53
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this.s.db), new run_command_1.RunCommandOperation(this.s.db, command, options), callback);
|
|
54
54
|
}
|
|
55
55
|
buildInfo(options, callback) {
|
|
56
56
|
if (typeof options === 'function')
|
|
@@ -93,25 +93,25 @@ class Admin {
|
|
|
93
93
|
(callback = options), (options = {});
|
|
94
94
|
}
|
|
95
95
|
options = Object.assign({ dbName: 'admin' }, options);
|
|
96
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this.s.db), new add_user_1.AddUserOperation(this.s.db, username, password, options), callback);
|
|
96
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this.s.db), new add_user_1.AddUserOperation(this.s.db, username, password, options), callback);
|
|
97
97
|
}
|
|
98
98
|
removeUser(username, options, callback) {
|
|
99
99
|
if (typeof options === 'function')
|
|
100
100
|
(callback = options), (options = {});
|
|
101
101
|
options = Object.assign({ dbName: 'admin' }, options);
|
|
102
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this.s.db), new remove_user_1.RemoveUserOperation(this.s.db, username, options), callback);
|
|
102
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this.s.db), new remove_user_1.RemoveUserOperation(this.s.db, username, options), callback);
|
|
103
103
|
}
|
|
104
104
|
validateCollection(collectionName, options, callback) {
|
|
105
105
|
if (typeof options === 'function')
|
|
106
106
|
(callback = options), (options = {});
|
|
107
107
|
options = options !== null && options !== void 0 ? options : {};
|
|
108
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this.s.db), new validate_collection_1.ValidateCollectionOperation(this, collectionName, options), callback);
|
|
108
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this.s.db), new validate_collection_1.ValidateCollectionOperation(this, collectionName, options), callback);
|
|
109
109
|
}
|
|
110
110
|
listDatabases(options, callback) {
|
|
111
111
|
if (typeof options === 'function')
|
|
112
112
|
(callback = options), (options = {});
|
|
113
113
|
options = options !== null && options !== void 0 ? options : {};
|
|
114
|
-
return execute_operation_1.executeOperation(utils_1.getTopology(this.s.db), new list_databases_1.ListDatabasesOperation(this.s.db, options), callback);
|
|
114
|
+
return (0, execute_operation_1.executeOperation)((0, utils_1.getTopology)(this.s.db), new list_databases_1.ListDatabasesOperation(this.s.db, options), callback);
|
|
115
115
|
}
|
|
116
116
|
replSetGetStatus(options, callback) {
|
|
117
117
|
if (typeof options === 'function')
|
package/lib/admin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":";;;AAAA,oDAAyE;AACzE,0DAAkF;AAClF,0EAG0C;AAC1C,gEAIqC;AACrC,sEAAkE;AAClE,0DAAkF;AAClF,mCAAgD;AAUhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAa,KAAK;IAIhB;;;OAGG;IACH,YAAY,EAAM;QAChB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC;IAClB,CAAC;IAaD,OAAO,CACL,OAAiB,EACjB,OAAgD,EAChD,QAA6B;QAE7B,IAAI,OAAO,OAAO,KAAK,UAAU;YAAE,CAAC,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;QACxE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,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