@dnax/core 0.64.5 → 0.64.7
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 -2
- package/driver/mongo/utils.ts +12 -11
- package/package.json +1 -1
package/driver/mongo/rest.ts
CHANGED
|
@@ -2023,9 +2023,9 @@ class useRest {
|
|
|
2023
2023
|
}
|
|
2024
2024
|
}
|
|
2025
2025
|
|
|
2026
|
-
abortTransaction() {
|
|
2026
|
+
async abortTransaction() {
|
|
2027
2027
|
if (this.#session) {
|
|
2028
|
-
this.#session?.abortTransaction();
|
|
2028
|
+
await this.#session?.abortTransaction();
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
2031
|
async commitTransaction() {
|
package/driver/mongo/utils.ts
CHANGED
|
@@ -241,22 +241,23 @@ 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(/(json|array)/) && data[f?.name]) {
|
|
244
245
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if(f?.injectAutoId && f?.type=='array') {
|
|
246
|
+
if (f?.injectAutoId && f?.type == "array") {
|
|
248
247
|
data[f.name]?.map((d, index) => {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
if (!d?._id) {
|
|
249
|
+
d._id = String(new ObjectId());
|
|
250
|
+
}
|
|
252
251
|
});
|
|
253
|
-
|
|
252
|
+
}
|
|
254
253
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
if (f?.injectAutoId && f?.type == "json") {
|
|
255
|
+
if (!data[f.name]?._id) {
|
|
256
|
+
data[f.name]._id = String(new ObjectId());
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
259
|
}
|
|
260
|
+
|
|
260
261
|
|
|
261
262
|
if (f?.type?.match(/(relationship|media)/) && data[f.name]) {
|
|
262
263
|
if (typeof data[f.name] == "object" && !Array.isArray(data[f.name])) {
|