@dnax/core 0.65.6 → 0.65.8
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/driver/mongo/rest.ts +2 -1
- package/driver/mongo/utils.ts +4 -0
- package/package.json +1 -1
package/driver/mongo/rest.ts
CHANGED
|
@@ -557,7 +557,7 @@ class useRest {
|
|
|
557
557
|
return resolve(result);
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
-
for await (let d of data) {
|
|
560
|
+
for await (let [index, d] of data.entries()) {
|
|
561
561
|
// Processing before validation
|
|
562
562
|
d = await setUUID(d, col);
|
|
563
563
|
d = await randomCode(d, col);
|
|
@@ -573,6 +573,7 @@ class useRest {
|
|
|
573
573
|
...d,
|
|
574
574
|
...(output || {}),
|
|
575
575
|
};
|
|
576
|
+
data[index] = d;
|
|
576
577
|
}
|
|
577
578
|
|
|
578
579
|
await this.#tenant.database.db?.collection(collection).insertMany(
|
package/driver/mongo/utils.ts
CHANGED
|
@@ -241,6 +241,10 @@ function toBson<T>(
|
|
|
241
241
|
function deepSetId(col: Collection, data: any) {
|
|
242
242
|
if (col) {
|
|
243
243
|
col?.fields?.map((f) => {
|
|
244
|
+
if (f?.type?.match(/(number|integer)/) && data[f.name] && f?.name) {
|
|
245
|
+
data[f.name] = Number(data[f.name]);
|
|
246
|
+
}
|
|
247
|
+
|
|
244
248
|
if (f?.type?.match(/(json|array)/) && data[f?.name] && f?.name) {
|
|
245
249
|
if (
|
|
246
250
|
f?.injectAutoId &&
|