@dnax/core 0.73.4 → 0.73.5
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 +18 -2
- package/package.json +1 -1
package/driver/mongo/rest.ts
CHANGED
|
@@ -1637,6 +1637,14 @@ class useRest {
|
|
|
1637
1637
|
if (!valid) fn.error(error, 400);
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
|
+
let $setOnInsert = update.$setOnInsert || {};
|
|
1641
|
+
// Processing before validation
|
|
1642
|
+
$setOnInsert = await setUUID($setOnInsert, col);
|
|
1643
|
+
$setOnInsert = await randomCode($setOnInsert, col);
|
|
1644
|
+
$setOnInsert = await hashPasswordAuto($setOnInsert, col);
|
|
1645
|
+
$setOnInsert = transformAllDate($setOnInsert);
|
|
1646
|
+
$setOnInsert = deepSetId(col, $setOnInsert);
|
|
1647
|
+
|
|
1640
1648
|
let up_ = await this.#tenant.database.db
|
|
1641
1649
|
?.collection(collection)
|
|
1642
1650
|
.updateMany(
|
|
@@ -1653,7 +1661,7 @@ class useRest {
|
|
|
1653
1661
|
},
|
|
1654
1662
|
$setOnInsert: {
|
|
1655
1663
|
createdAt: new Date(),
|
|
1656
|
-
...formatData(
|
|
1664
|
+
...formatData($setOnInsert || {}, {
|
|
1657
1665
|
collection: collection,
|
|
1658
1666
|
tenant_id: this.#tenant_id,
|
|
1659
1667
|
action: "updateMany",
|
|
@@ -1803,6 +1811,14 @@ class useRest {
|
|
|
1803
1811
|
if (!valid) fn.error(error, 400);
|
|
1804
1812
|
}
|
|
1805
1813
|
|
|
1814
|
+
let $setOnInsert = update.$setOnInsert || {};
|
|
1815
|
+
// Processing before validation
|
|
1816
|
+
$setOnInsert = await setUUID($setOnInsert, col);
|
|
1817
|
+
$setOnInsert = await randomCode($setOnInsert, col);
|
|
1818
|
+
$setOnInsert = await hashPasswordAuto($setOnInsert, col);
|
|
1819
|
+
$setOnInsert = transformAllDate($setOnInsert);
|
|
1820
|
+
$setOnInsert = deepSetId(col, $setOnInsert);
|
|
1821
|
+
|
|
1806
1822
|
result.doc = await this.#tenant.database.db
|
|
1807
1823
|
?.collection(collection)
|
|
1808
1824
|
.findOneAndUpdate(
|
|
@@ -1816,7 +1832,7 @@ class useRest {
|
|
|
1816
1832
|
}),
|
|
1817
1833
|
|
|
1818
1834
|
$setOnInsert: {
|
|
1819
|
-
...formatData(
|
|
1835
|
+
...formatData($setOnInsert || {}, {
|
|
1820
1836
|
collection: collection,
|
|
1821
1837
|
tenant_id: this.#tenant_id,
|
|
1822
1838
|
action: "insertOne",
|