@toa.io/storages.mongodb 1.0.0-alpha.61 → 1.0.0-alpha.64
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/package.json +7 -7
- package/src/client.js +2 -1
- package/src/storage.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/storages.mongodb",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.64",
|
|
4
4
|
"description": "Toa MongoDB Storage Connector",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@toa.io/
|
|
23
|
-
"@toa.io/
|
|
24
|
-
"@toa.io/
|
|
25
|
-
"@toa.io/
|
|
26
|
-
"@toa.io/pointer": "1.0.0-alpha.61",
|
|
22
|
+
"@toa.io/conveyor": "1.0.0-alpha.63",
|
|
23
|
+
"@toa.io/core": "1.0.0-alpha.64",
|
|
24
|
+
"@toa.io/generic": "1.0.0-alpha.63",
|
|
25
|
+
"@toa.io/pointer": "1.0.0-alpha.63",
|
|
27
26
|
"mongodb": "6.7.0",
|
|
27
|
+
"openspan": "1.0.0-alpha.63",
|
|
28
28
|
"saslprep": "1.0.3"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "2a79179b0e6e21ff48eee481d9d71ed0e5d6b343"
|
|
31
31
|
}
|
package/src/client.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @typedef {import('@toa.io/core').Locator} Locator
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
const { console } = require('openspan')
|
|
9
10
|
const { Connector } = require('@toa.io/core')
|
|
10
11
|
const { resolve } = require('@toa.io/pointer')
|
|
11
12
|
const { ID } = require('./deployment')
|
|
@@ -107,7 +108,7 @@ class Client extends Connector {
|
|
|
107
108
|
const client = new MongoClient(urls.join(','), OPTIONS)
|
|
108
109
|
const hosts = urls.map((str) => new URL(str).host)
|
|
109
110
|
|
|
110
|
-
console.info('Connecting to MongoDB
|
|
111
|
+
console.info('Connecting to MongoDB', { address: hosts.join(', ') })
|
|
111
112
|
|
|
112
113
|
await client.connect()
|
|
113
114
|
|
package/src/storage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { Connector, exceptions } = require('@toa.io/core')
|
|
4
|
-
|
|
4
|
+
const { console } = require('openspan')
|
|
5
5
|
const { translate } = require('./translate')
|
|
6
6
|
const { to, from } = require('./record')
|
|
7
7
|
const { ReturnDocument } = require('mongodb')
|
|
@@ -181,7 +181,7 @@ class Storage extends Connector {
|
|
|
181
181
|
const obsolete = current.filter((name) => !desired.includes(name))
|
|
182
182
|
|
|
183
183
|
if (obsolete.length > 0) {
|
|
184
|
-
console.info(
|
|
184
|
+
console.info('Removing obsolete indexes', { indexes: obsolete.join(', ') })
|
|
185
185
|
|
|
186
186
|
await Promise.all(obsolete.map((name) => this.#collection.dropIndex(name)))
|
|
187
187
|
}
|
|
@@ -209,7 +209,7 @@ class Storage extends Connector {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
if (optional.length > 0) {
|
|
212
|
-
console.info(
|
|
212
|
+
console.info('Index fields are optional, creating sparse index', { fields: optional.join(', ') })
|
|
213
213
|
|
|
214
214
|
return true
|
|
215
215
|
} else
|