mongodb 4.13.0 → 5.0.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 +38 -23
- package/lib/admin.js +82 -63
- package/lib/admin.js.map +1 -1
- package/lib/bson.js +16 -28
- package/lib/bson.js.map +1 -1
- package/lib/bulk/common.js +51 -152
- package/lib/bulk/common.js.map +1 -1
- package/lib/change_stream.js +70 -77
- package/lib/change_stream.js.map +1 -1
- package/lib/cmap/auth/gssapi.js +2 -4
- package/lib/cmap/auth/gssapi.js.map +1 -1
- package/lib/cmap/auth/mongo_credentials.js +6 -14
- package/lib/cmap/auth/mongo_credentials.js.map +1 -1
- package/lib/cmap/auth/mongodb_aws.js +4 -2
- package/lib/cmap/auth/mongodb_aws.js.map +1 -1
- package/lib/cmap/command_monitoring_events.js +1 -2
- package/lib/cmap/command_monitoring_events.js.map +1 -1
- package/lib/cmap/commands.js +13 -15
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connect.js +14 -18
- package/lib/cmap/connect.js.map +1 -1
- package/lib/cmap/connection.js +15 -10
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/connection_pool.js +9 -16
- package/lib/cmap/connection_pool.js.map +1 -1
- package/lib/cmap/errors.js +1 -2
- package/lib/cmap/errors.js.map +1 -1
- package/lib/cmap/message_stream.js +13 -15
- package/lib/cmap/message_stream.js.map +1 -1
- package/lib/cmap/stream_description.js +3 -3
- package/lib/cmap/stream_description.js.map +1 -1
- package/lib/cmap/wire_protocol/compression.js +29 -44
- package/lib/cmap/wire_protocol/compression.js.map +1 -1
- package/lib/cmap/wire_protocol/shared.js +1 -1
- package/lib/cmap/wire_protocol/shared.js.map +1 -1
- package/lib/collection.js +321 -280
- package/lib/collection.js.map +1 -1
- package/lib/connection_string.js +13 -45
- package/lib/connection_string.js.map +1 -1
- package/lib/cursor/abstract_cursor.js +81 -74
- package/lib/cursor/abstract_cursor.js.map +1 -1
- package/lib/cursor/aggregation_cursor.js +4 -7
- package/lib/cursor/aggregation_cursor.js.map +1 -1
- package/lib/cursor/find_cursor.js +14 -15
- package/lib/cursor/find_cursor.js.map +1 -1
- package/lib/db.js +119 -108
- package/lib/db.js.map +1 -1
- package/lib/deps.js +1 -7
- package/lib/deps.js.map +1 -1
- package/lib/encrypter.js +4 -9
- package/lib/encrypter.js.map +1 -1
- package/lib/error.js +2 -4
- package/lib/error.js.map +1 -1
- package/lib/explain.js +1 -1
- package/lib/explain.js.map +1 -1
- package/lib/gridfs/download.js +15 -18
- package/lib/gridfs/download.js.map +1 -1
- package/lib/gridfs/index.js +32 -33
- package/lib/gridfs/index.js.map +1 -1
- package/lib/gridfs/upload.js +79 -114
- package/lib/gridfs/upload.js.map +1 -1
- package/lib/index.js +22 -36
- package/lib/index.js.map +1 -1
- package/lib/mongo_client.js +102 -115
- package/lib/mongo_client.js.map +1 -1
- package/lib/mongo_logger.js +7 -8
- package/lib/mongo_logger.js.map +1 -1
- package/lib/mongo_types.js +1 -25
- package/lib/mongo_types.js.map +1 -1
- package/lib/operations/add_user.js +4 -2
- package/lib/operations/add_user.js.map +1 -1
- package/lib/operations/aggregate.js +3 -3
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/bulk_write.js +1 -8
- package/lib/operations/bulk_write.js.map +1 -1
- package/lib/operations/collections.js +13 -10
- package/lib/operations/collections.js.map +1 -1
- package/lib/operations/command.js +3 -7
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/common_functions.js +4 -6
- package/lib/operations/common_functions.js.map +1 -1
- package/lib/operations/create_collection.js +5 -5
- package/lib/operations/create_collection.js.map +1 -1
- package/lib/operations/delete.js +3 -9
- package/lib/operations/delete.js.map +1 -1
- package/lib/operations/distinct.js +1 -1
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/drop.js +3 -4
- package/lib/operations/drop.js.map +1 -1
- package/lib/operations/estimated_document_count.js +1 -1
- package/lib/operations/estimated_document_count.js.map +1 -1
- package/lib/operations/eval.js +1 -1
- package/lib/operations/eval.js.map +1 -1
- package/lib/operations/execute_operation.js +6 -7
- package/lib/operations/execute_operation.js.map +1 -1
- package/lib/operations/find_and_modify.js +2 -3
- package/lib/operations/find_and_modify.js.map +1 -1
- package/lib/operations/indexes.js +16 -17
- package/lib/operations/indexes.js.map +1 -1
- package/lib/operations/insert.js +4 -8
- package/lib/operations/insert.js.map +1 -1
- package/lib/operations/is_capped.js +4 -6
- package/lib/operations/is_capped.js.map +1 -1
- package/lib/operations/list_collections.js +1 -1
- 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/operation.js +1 -2
- package/lib/operations/operation.js.map +1 -1
- package/lib/operations/options_operation.js +4 -5
- package/lib/operations/options_operation.js.map +1 -1
- package/lib/operations/rename.js +1 -1
- 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/stats.js +1 -1
- package/lib/operations/stats.js.map +1 -1
- package/lib/operations/update.js +4 -8
- package/lib/operations/update.js.map +1 -1
- package/lib/read_concern.js +1 -2
- package/lib/read_concern.js.map +1 -1
- package/lib/read_preference.js +4 -13
- package/lib/read_preference.js.map +1 -1
- package/lib/sdam/events.js +1 -1
- package/lib/sdam/events.js.map +1 -1
- package/lib/sdam/monitor.js +18 -26
- package/lib/sdam/monitor.js.map +1 -1
- package/lib/sdam/server.js +9 -14
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/server_description.js +22 -23
- package/lib/sdam/server_description.js.map +1 -1
- package/lib/sdam/server_selection.js +2 -4
- package/lib/sdam/server_selection.js.map +1 -1
- package/lib/sdam/srv_polling.js +8 -19
- package/lib/sdam/srv_polling.js.map +1 -1
- package/lib/sdam/topology.js +26 -40
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sdam/topology_description.js +11 -13
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +70 -70
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js +1 -1
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +34 -97
- package/lib/utils.js.map +1 -1
- package/lib/write_concern.js +2 -2
- package/lib/write_concern.js.map +1 -1
- package/mongodb.d.ts +142 -896
- package/package.json +32 -15
- package/src/admin.ts +33 -184
- package/src/bson.ts +7 -27
- package/src/bulk/common.ts +57 -172
- package/src/change_stream.ts +58 -88
- package/src/cmap/auth/gssapi.ts +0 -2
- package/src/cmap/auth/mongo_credentials.ts +0 -9
- package/src/cmap/auth/mongodb_aws.ts +6 -3
- package/src/cmap/commands.ts +3 -3
- package/src/cmap/connect.ts +1 -1
- package/src/cmap/connection.ts +10 -19
- package/src/cmap/connection_pool.ts +0 -6
- package/src/cmap/message_stream.ts +51 -50
- package/src/cmap/wire_protocol/compression.ts +39 -65
- package/src/collection.ts +111 -888
- package/src/connection_string.ts +0 -28
- package/src/cursor/abstract_cursor.ts +65 -116
- package/src/cursor/aggregation_cursor.ts +3 -14
- package/src/cursor/find_cursor.ts +9 -34
- package/src/db.ts +49 -327
- package/src/deps.ts +2 -25
- package/src/encrypter.ts +6 -8
- package/src/gridfs/download.ts +31 -19
- package/src/gridfs/index.ts +22 -46
- package/src/gridfs/upload.ts +100 -144
- package/src/index.ts +6 -30
- package/src/mongo_client.ts +89 -173
- package/src/mongo_types.ts +65 -62
- package/src/operations/add_user.ts +3 -3
- package/src/operations/bulk_write.ts +4 -9
- package/src/operations/collections.ts +19 -17
- package/src/operations/command.ts +0 -10
- package/src/operations/common_functions.ts +9 -6
- package/src/operations/delete.ts +0 -7
- package/src/operations/indexes.ts +12 -11
- package/src/operations/is_capped.ts +11 -9
- package/src/operations/options_operation.ts +11 -8
- package/src/read_preference.ts +0 -9
- package/src/sdam/monitor.ts +1 -1
- package/src/sdam/server.ts +6 -8
- package/src/sdam/server_selection.ts +1 -1
- package/src/sdam/srv_polling.ts +6 -20
- package/src/sdam/topology.ts +1 -26
- package/src/sessions.ts +31 -58
- package/src/utils.ts +23 -106
- package/tsconfig.json +10 -4
- package/lib/logger.js +0 -218
- package/lib/logger.js.map +0 -1
- package/lib/operations/map_reduce.js +0 -166
- package/lib/operations/map_reduce.js.map +0 -1
- package/lib/promise_provider.js +0 -51
- package/lib/promise_provider.js.map +0 -1
- package/src/logger.ts +0 -266
- package/src/operations/map_reduce.ts +0 -250
- package/src/promise_provider.ts +0 -56
package/README.md
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
The official [MongoDB](https://www.mongodb.com/) driver for Node.js.
|
|
4
4
|
|
|
5
|
-
**Upgrading to version
|
|
5
|
+
**Upgrading to version 5? Take a look at our [upgrade guide here](https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES_5.0.0.md)!**
|
|
6
6
|
|
|
7
7
|
## Quick Links
|
|
8
8
|
|
|
9
|
-
| what | where
|
|
10
|
-
| ------------- |
|
|
11
|
-
| documentation | [
|
|
12
|
-
| api-doc | [mongodb.github.io/node-mongodb-native
|
|
13
|
-
| npm package | [www.npmjs.com/package/mongodb](https://www.npmjs.com/package/mongodb)
|
|
14
|
-
| source | [github.com/mongodb/node-mongodb-native](https://github.com/mongodb/node-mongodb-native)
|
|
15
|
-
| mongodb | [www.mongodb.com](https://www.mongodb.com)
|
|
16
|
-
| changelog | [HISTORY.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/HISTORY.md)
|
|
17
|
-
| upgrade to
|
|
18
|
-
| contributing | [CONTRIBUTING.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/CONTRIBUTING.md)
|
|
9
|
+
| what | where |
|
|
10
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| documentation | [www.mongodb.com/docs/drivers/node](https://www.mongodb.com/docs/drivers/node) |
|
|
12
|
+
| api-doc | [mongodb.github.io/node-mongodb-native](https://mongodb.github.io/node-mongodb-native) |
|
|
13
|
+
| npm package | [www.npmjs.com/package/mongodb](https://www.npmjs.com/package/mongodb) |
|
|
14
|
+
| source | [github.com/mongodb/node-mongodb-native](https://github.com/mongodb/node-mongodb-native) |
|
|
15
|
+
| mongodb | [www.mongodb.com](https://www.mongodb.com) |
|
|
16
|
+
| changelog | [HISTORY.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/HISTORY.md) |
|
|
17
|
+
| upgrade to v5 | [etc/notes/CHANGES_5.0.0.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES_5.0.0.md) |
|
|
18
|
+
| contributing | [CONTRIBUTING.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/CONTRIBUTING.md) |
|
|
19
19
|
|
|
20
20
|
### Bugs / Feature Requests
|
|
21
21
|
|
|
@@ -53,7 +53,7 @@ If you run into any unexpected compiler failures against our supported TypeScrip
|
|
|
53
53
|
|
|
54
54
|
## Installation
|
|
55
55
|
|
|
56
|
-
The recommended way to get started using the Node.js
|
|
56
|
+
The recommended way to get started using the Node.js 5.x driver is by using the `npm` (Node Package Manager) to install the dependency in your project.
|
|
57
57
|
|
|
58
58
|
After you've created your own project using `npm init`, you can run:
|
|
59
59
|
|
|
@@ -71,16 +71,23 @@ If you are a Typescript user, you will need the Node.js type definitions to use
|
|
|
71
71
|
npm install -D @types/node
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
##
|
|
74
|
+
## Driver Extensions
|
|
75
75
|
|
|
76
|
-
The MongoDB driver
|
|
76
|
+
The MongoDB driver can optionally be enhanced by the following feature packages:
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
- [bson-ext](https://github.com/mongodb-js/bson-ext)
|
|
80
|
-
- [kerberos](https://github.com/mongodb-js/kerberos)
|
|
81
|
-
- [mongodb-client-encryption](https://github.com/mongodb/libmongocrypt#readme)
|
|
78
|
+
Maintained by MongoDB:
|
|
82
79
|
|
|
83
|
-
|
|
80
|
+
- Zstd network compression - [@mongodb-js/zstd](https://github.com/mongodb-js/zstd)
|
|
81
|
+
- MongoDB field level and queryable encryption - [mongodb-client-encryption](https://github.com/mongodb/libmongocrypt#readme)
|
|
82
|
+
- GSSAPI / SSPI / Kerberos authentication - [kerberos](https://github.com/mongodb-js/kerberos)
|
|
83
|
+
|
|
84
|
+
Some of these packages include native C++ extensions.
|
|
85
|
+
Consult the [trouble shooting guide here](https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/native-extensions.md) if you run into compilation issues.
|
|
86
|
+
|
|
87
|
+
Third party:
|
|
88
|
+
|
|
89
|
+
- Snappy network compression - [snappy](https://github.com/Brooooooklyn/snappy)
|
|
90
|
+
- AWS authentication - [@aws-sdk/credential-providers](https://github.com/aws/aws-sdk-js-v3/tree/main/packages/credential-providers)
|
|
84
91
|
|
|
85
92
|
## Quick Start
|
|
86
93
|
|
|
@@ -128,10 +135,18 @@ operations using the MongoDB driver.
|
|
|
128
135
|
|
|
129
136
|
Add code to connect to the server and the database **myProject**:
|
|
130
137
|
|
|
131
|
-
> **NOTE:**
|
|
138
|
+
> **NOTE:** Resolving DNS Connection issues
|
|
139
|
+
>
|
|
140
|
+
> Node.js 18 changed the default DNS resolution ordering from always prioritizing ipv4 to the ordering
|
|
141
|
+
> returned by the DNS provider. In some environments, this can result in `localhost` resolving to
|
|
142
|
+
> an ipv6 address instead of ipv4 and a consequent failure to connect to the server.
|
|
143
|
+
>
|
|
144
|
+
> This can be resolved by:
|
|
132
145
|
>
|
|
133
|
-
>
|
|
134
|
-
>
|
|
146
|
+
> - specifying the ip address family using the MongoClient `family` option (`MongoClient(<uri>, { family: 4 } )`)
|
|
147
|
+
> - launching mongod or mongos with the ipv6 flag enabled ([--ipv6 mongod option documentation](https://www.mongodb.com/docs/manual/reference/program/mongod/#std-option-mongod.--ipv6))
|
|
148
|
+
> - using a host of `127.0.0.1` in place of localhost
|
|
149
|
+
> - specifying the DNS resolution ordering with the `--dns-resolution-order` Node.js command line argument (e.g. `node --dns-resolution-order=ipv4first`)
|
|
135
150
|
|
|
136
151
|
```js
|
|
137
152
|
const { MongoClient } = require('mongodb');
|
|
@@ -247,7 +262,7 @@ It is our recommendation to use `instanceof` checks on errors and to avoid relyi
|
|
|
247
262
|
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.
|
|
248
263
|
|
|
249
264
|
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.
|
|
250
|
-
This means `instanceof` will always be able to accurately capture the errors that our driver throws
|
|
265
|
+
This means `instanceof` will always be able to accurately capture the errors that our driver throws.
|
|
251
266
|
|
|
252
267
|
```typescript
|
|
253
268
|
const client = new MongoClient(url);
|
package/lib/admin.js
CHANGED
|
@@ -34,78 +34,97 @@ class Admin {
|
|
|
34
34
|
constructor(db) {
|
|
35
35
|
this.s = { db };
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Execute a command
|
|
39
|
+
*
|
|
40
|
+
* @param command - The command to execute
|
|
41
|
+
* @param options - Optional settings for the command
|
|
42
|
+
*/
|
|
43
|
+
async command(command, options) {
|
|
44
|
+
return (0, execute_operation_1.executeOperation)(this.s.db.s.client, new run_command_1.RunCommandOperation(this.s.db, command, { dbName: 'admin', ...options }));
|
|
42
45
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Retrieve the server build information
|
|
48
|
+
*
|
|
49
|
+
* @param options - Optional settings for the command
|
|
50
|
+
*/
|
|
51
|
+
async buildInfo(options) {
|
|
52
|
+
return this.command({ buildinfo: 1 }, options);
|
|
48
53
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Retrieve the server build information
|
|
56
|
+
*
|
|
57
|
+
* @param options - Optional settings for the command
|
|
58
|
+
*/
|
|
59
|
+
async serverInfo(options) {
|
|
60
|
+
return this.command({ buildinfo: 1 }, options);
|
|
54
61
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Retrieve this db's server status.
|
|
64
|
+
*
|
|
65
|
+
* @param options - Optional settings for the command
|
|
66
|
+
*/
|
|
67
|
+
async serverStatus(options) {
|
|
68
|
+
return this.command({ serverStatus: 1 }, options);
|
|
60
69
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Ping the MongoDB server and retrieve results
|
|
72
|
+
*
|
|
73
|
+
* @param options - Optional settings for the command
|
|
74
|
+
*/
|
|
75
|
+
async ping(options) {
|
|
76
|
+
return this.command({ ping: 1 }, options);
|
|
66
77
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
options = Object.assign({ dbName: 'admin' }, options);
|
|
84
|
-
return (0, execute_operation_1.executeOperation)(this.s.db.s.client, new add_user_1.AddUserOperation(this.s.db, username, password, options), callback);
|
|
78
|
+
/**
|
|
79
|
+
* Add a user to the database
|
|
80
|
+
*
|
|
81
|
+
* @param username - The username for the new user
|
|
82
|
+
* @param passwordOrOptions - An optional password for the new user, or the options for the command
|
|
83
|
+
* @param options - Optional settings for the command
|
|
84
|
+
*/
|
|
85
|
+
async addUser(username, passwordOrOptions, options) {
|
|
86
|
+
options =
|
|
87
|
+
options != null && typeof options === 'object'
|
|
88
|
+
? options
|
|
89
|
+
: passwordOrOptions != null && typeof passwordOrOptions === 'object'
|
|
90
|
+
? passwordOrOptions
|
|
91
|
+
: undefined;
|
|
92
|
+
const password = typeof passwordOrOptions === 'string' ? passwordOrOptions : undefined;
|
|
93
|
+
return (0, execute_operation_1.executeOperation)(this.s.db.s.client, new add_user_1.AddUserOperation(this.s.db, username, password, { dbName: 'admin', ...options }));
|
|
85
94
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Remove a user from a database
|
|
97
|
+
*
|
|
98
|
+
* @param username - The username to remove
|
|
99
|
+
* @param options - Optional settings for the command
|
|
100
|
+
*/
|
|
101
|
+
async removeUser(username, options) {
|
|
102
|
+
return (0, execute_operation_1.executeOperation)(this.s.db.s.client, new remove_user_1.RemoveUserOperation(this.s.db, username, { dbName: 'admin', ...options }));
|
|
91
103
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Validate an existing collection
|
|
106
|
+
*
|
|
107
|
+
* @param collectionName - The name of the collection to validate.
|
|
108
|
+
* @param options - Optional settings for the command
|
|
109
|
+
*/
|
|
110
|
+
async validateCollection(collectionName, options = {}) {
|
|
111
|
+
return (0, execute_operation_1.executeOperation)(this.s.db.s.client, new validate_collection_1.ValidateCollectionOperation(this, collectionName, options));
|
|
97
112
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
/**
|
|
114
|
+
* List the available databases
|
|
115
|
+
*
|
|
116
|
+
* @param options - Optional settings for the command
|
|
117
|
+
*/
|
|
118
|
+
async listDatabases(options) {
|
|
119
|
+
return (0, execute_operation_1.executeOperation)(this.s.db.s.client, new list_databases_1.ListDatabasesOperation(this.s.db, options));
|
|
103
120
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Get ReplicaSet status
|
|
123
|
+
*
|
|
124
|
+
* @param options - Optional settings for the command
|
|
125
|
+
*/
|
|
126
|
+
async replSetGetStatus(options) {
|
|
127
|
+
return this.command({ replSetGetStatus: 1 }, options);
|
|
109
128
|
}
|
|
110
129
|
}
|
|
111
130
|
exports.Admin = Admin;
|
package/lib/admin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":";;;AAEA,oDAAyE;AAEzE,sEAAkE;AAClE,gEAIqC;AACrC,0DAAkF;AAClF,0DAAkF;AAClF,0EAG0C;
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":";;;AAEA,oDAAyE;AAEzE,sEAAkE;AAClE,gEAIqC;AACrC,0DAAkF;AAClF,0DAAkF;AAClF,0EAG0C;AAO1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,KAAK;IAIhB;;;OAGG;IACH,YAAY,EAAM;QAChB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,OAAiB,EAAE,OAA2B;QAC1D,OAAO,IAAA,oCAAgB,EACrB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAClB,IAAI,iCAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,CAC7E,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,OAAiC;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,OAAiC;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,E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,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,CAC9E,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CACtB,cAAsB,EACtB,UAAqC,EAAE;QAEvC,OAAO,IAAA,oCAAgB,EACrB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAClB,IAAI,iDAA2B,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,CAC/D,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,OAA8B;QAChD,OAAO,IAAA,oCAAgB,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,uCAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAiC;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CACF;AApID,sBAoIC"}
|
package/lib/bson.js
CHANGED
|
@@ -1,35 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveBSONOptions = exports.pluckBSONSerializeOptions = exports.
|
|
4
|
-
/** @internal */
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
6
|
-
let BSON = require('bson');
|
|
7
|
-
exports.BSON = BSON;
|
|
8
|
-
try {
|
|
9
|
-
// Ensure you always wrap an optional require in the try block NODE-3199
|
|
10
|
-
exports.BSON = BSON = require('bson-ext');
|
|
11
|
-
}
|
|
12
|
-
catch { } // eslint-disable-line
|
|
13
|
-
/** @internal */
|
|
14
|
-
exports.deserialize = BSON.deserialize;
|
|
15
|
-
/** @internal */
|
|
16
|
-
exports.serialize = BSON.serialize;
|
|
17
|
-
/** @internal */
|
|
18
|
-
exports.calculateObjectSize = BSON.calculateObjectSize;
|
|
3
|
+
exports.resolveBSONOptions = exports.pluckBSONSerializeOptions = exports.Timestamp = exports.serialize = exports.ObjectId = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.Double = exports.deserialize = exports.Decimal128 = exports.DBRef = exports.Code = exports.calculateObjectSize = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.BSON = exports.Binary = void 0;
|
|
19
4
|
var bson_1 = require("bson");
|
|
20
5
|
Object.defineProperty(exports, "Binary", { enumerable: true, get: function () { return bson_1.Binary; } });
|
|
6
|
+
Object.defineProperty(exports, "BSON", { enumerable: true, get: function () { return bson_1.BSON; } });
|
|
21
7
|
Object.defineProperty(exports, "BSONRegExp", { enumerable: true, get: function () { return bson_1.BSONRegExp; } });
|
|
22
8
|
Object.defineProperty(exports, "BSONSymbol", { enumerable: true, get: function () { return bson_1.BSONSymbol; } });
|
|
9
|
+
Object.defineProperty(exports, "BSONType", { enumerable: true, get: function () { return bson_1.BSONType; } });
|
|
10
|
+
Object.defineProperty(exports, "calculateObjectSize", { enumerable: true, get: function () { return bson_1.calculateObjectSize; } });
|
|
23
11
|
Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return bson_1.Code; } });
|
|
24
12
|
Object.defineProperty(exports, "DBRef", { enumerable: true, get: function () { return bson_1.DBRef; } });
|
|
25
13
|
Object.defineProperty(exports, "Decimal128", { enumerable: true, get: function () { return bson_1.Decimal128; } });
|
|
14
|
+
Object.defineProperty(exports, "deserialize", { enumerable: true, get: function () { return bson_1.deserialize; } });
|
|
26
15
|
Object.defineProperty(exports, "Double", { enumerable: true, get: function () { return bson_1.Double; } });
|
|
27
16
|
Object.defineProperty(exports, "Int32", { enumerable: true, get: function () { return bson_1.Int32; } });
|
|
28
17
|
Object.defineProperty(exports, "Long", { enumerable: true, get: function () { return bson_1.Long; } });
|
|
29
|
-
Object.defineProperty(exports, "Map", { enumerable: true, get: function () { return bson_1.Map; } });
|
|
30
18
|
Object.defineProperty(exports, "MaxKey", { enumerable: true, get: function () { return bson_1.MaxKey; } });
|
|
31
19
|
Object.defineProperty(exports, "MinKey", { enumerable: true, get: function () { return bson_1.MinKey; } });
|
|
32
20
|
Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return bson_1.ObjectId; } });
|
|
21
|
+
Object.defineProperty(exports, "serialize", { enumerable: true, get: function () { return bson_1.serialize; } });
|
|
33
22
|
Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return bson_1.Timestamp; } });
|
|
34
23
|
function pluckBSONSerializeOptions(options) {
|
|
35
24
|
const { fieldsAsRaw, promoteValues, promoteBuffers, promoteLongs, serializeFunctions, ignoreUndefined, bsonRegExp, raw, enableUtf8Validation } = options;
|
|
@@ -53,18 +42,17 @@ exports.pluckBSONSerializeOptions = pluckBSONSerializeOptions;
|
|
|
53
42
|
* @internal
|
|
54
43
|
*/
|
|
55
44
|
function resolveBSONOptions(options, parent) {
|
|
56
|
-
|
|
57
|
-
const parentOptions = parent === null || parent === void 0 ? void 0 : parent.bsonOptions;
|
|
45
|
+
const parentOptions = parent?.bsonOptions;
|
|
58
46
|
return {
|
|
59
|
-
raw:
|
|
60
|
-
promoteLongs:
|
|
61
|
-
promoteValues:
|
|
62
|
-
promoteBuffers:
|
|
63
|
-
ignoreUndefined:
|
|
64
|
-
bsonRegExp:
|
|
65
|
-
serializeFunctions:
|
|
66
|
-
fieldsAsRaw:
|
|
67
|
-
enableUtf8Validation:
|
|
47
|
+
raw: options?.raw ?? parentOptions?.raw ?? false,
|
|
48
|
+
promoteLongs: options?.promoteLongs ?? parentOptions?.promoteLongs ?? true,
|
|
49
|
+
promoteValues: options?.promoteValues ?? parentOptions?.promoteValues ?? true,
|
|
50
|
+
promoteBuffers: options?.promoteBuffers ?? parentOptions?.promoteBuffers ?? false,
|
|
51
|
+
ignoreUndefined: options?.ignoreUndefined ?? parentOptions?.ignoreUndefined ?? false,
|
|
52
|
+
bsonRegExp: options?.bsonRegExp ?? parentOptions?.bsonRegExp ?? false,
|
|
53
|
+
serializeFunctions: options?.serializeFunctions ?? parentOptions?.serializeFunctions ?? false,
|
|
54
|
+
fieldsAsRaw: options?.fieldsAsRaw ?? parentOptions?.fieldsAsRaw ?? {},
|
|
55
|
+
enableUtf8Validation: options?.enableUtf8Validation ?? parentOptions?.enableUtf8Validation ?? true
|
|
68
56
|
};
|
|
69
57
|
}
|
|
70
58
|
exports.resolveBSONOptions = resolveBSONOptions;
|
package/lib/bson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bson.js","sourceRoot":"","sources":["../src/bson.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bson.js","sourceRoot":"","sources":["../src/bson.ts"],"names":[],"mappings":";;;AAEA,6BAoBc;AAnBZ,8FAAA,MAAM,OAAA;AACN,4FAAA,IAAI,OAAA;AACJ,kGAAA,UAAU,OAAA;AACV,kGAAA,UAAU,OAAA;AACV,gGAAA,QAAQ,OAAA;AACR,2GAAA,mBAAmB,OAAA;AACnB,4FAAA,IAAI,OAAA;AACJ,6FAAA,KAAK,OAAA;AACL,kGAAA,UAAU,OAAA;AACV,mGAAA,WAAW,OAAA;AAEX,8FAAA,MAAM,OAAA;AACN,6FAAA,KAAK,OAAA;AACL,4FAAA,IAAI,OAAA;AACJ,8FAAA,MAAM,OAAA;AACN,8FAAA,MAAM,OAAA;AACN,gGAAA,QAAQ,OAAA;AACR,iGAAA,SAAS,OAAA;AACT,iGAAA,SAAS,OAAA;AA6CX,SAAgB,yBAAyB,CAAC,OAA6B;IACrE,MAAM,EACJ,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,GAAG,EACH,oBAAoB,EACrB,GAAG,OAAO,CAAC;IACZ,OAAO;QACL,WAAW;QACX,aAAa;QACb,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