@toa.io/storages.mongodb 1.0.0-alpha.310 → 1.0.0-alpha.312
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/CHANGELOG.md +15 -0
- package/package.json +7 -7
- package/src/client.js +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.312](https://github.com/toa-io/toa/compare/v1.0.0-alpha.311...v1.0.0-alpha.312) (2026-09-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @toa.io/storages.mongodb
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.0.0-alpha.311](https://github.com/toa-io/toa/compare/v1.0.0-alpha.310...v1.0.0-alpha.311) (2026-09-17)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* name the database after the scope ([4d7203f](https://github.com/toa-io/toa/commit/4d7203fd18828895272a9dae76e351d92b49277f))
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# [1.0.0-alpha.310](https://github.com/toa-io/toa/compare/v1.0.0-alpha.309...v1.0.0-alpha.310) (2026-09-16)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @toa.io/storages.mongodb
|
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.312",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa MongoDB Storage Connector",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@toa.io/conveyor": "1.0.0-alpha.
|
|
24
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
25
|
-
"@toa.io/definitions": "1.0.0-alpha.
|
|
26
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
27
|
-
"@toa.io/pointer": "1.0.0-alpha.
|
|
23
|
+
"@toa.io/conveyor": "1.0.0-alpha.311",
|
|
24
|
+
"@toa.io/core": "1.0.0-alpha.312",
|
|
25
|
+
"@toa.io/definitions": "1.0.0-alpha.312",
|
|
26
|
+
"@toa.io/generic": "1.0.0-alpha.311",
|
|
27
|
+
"@toa.io/pointer": "1.0.0-alpha.311",
|
|
28
28
|
"mongodb": "7.6.0",
|
|
29
29
|
"openspan": "1.0.0-alpha.305"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "3cdff9b9779eeb6ae83913fefc0b502a10a0236a"
|
|
32
32
|
}
|
package/src/client.js
CHANGED
|
@@ -239,16 +239,23 @@ export class Client extends Connector {
|
|
|
239
239
|
* @return {string}
|
|
240
240
|
*/
|
|
241
241
|
resolveDB() {
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (
|
|
242
|
+
const scope = environment.scope()
|
|
243
|
+
const length = Buffer.byteLength(scope)
|
|
244
|
+
|
|
245
|
+
// MongoDB refuses the name only when something is first written, far from what caused it
|
|
246
|
+
if (length > MAX_DB_LENGTH)
|
|
247
|
+
throw new Error(
|
|
248
|
+
`Database name '${scope}' is ${length} bytes, and MongoDB takes no more than ` +
|
|
249
|
+
`${MAX_DB_LENGTH}: shorten TOA_CONTEXT or TOA_SUFFIX`
|
|
250
|
+
)
|
|
247
251
|
|
|
248
|
-
|
|
252
|
+
return scope
|
|
249
253
|
}
|
|
250
254
|
}
|
|
251
255
|
|
|
256
|
+
/** what MongoDB takes for a database name, in bytes */
|
|
257
|
+
const MAX_DB_LENGTH = 63
|
|
258
|
+
|
|
252
259
|
function getKey(db, urls) {
|
|
253
260
|
return db + ':' + urls.sort().join(' ')
|
|
254
261
|
}
|