@dnax/core 0.65.1 → 0.65.3
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 +3 -1
- package/driver/mongo/utils.ts +6 -4
- package/package.json +1 -1
package/driver/mongo/rest.ts
CHANGED
|
@@ -1190,7 +1190,9 @@ class useRest {
|
|
|
1190
1190
|
},
|
|
1191
1191
|
{
|
|
1192
1192
|
upsert: options?.upsert ?? false,
|
|
1193
|
-
arrayFilters: options?.arrayFilters
|
|
1193
|
+
arrayFilters: options?.arrayFilters
|
|
1194
|
+
? toBson(options?.arrayFilters)
|
|
1195
|
+
: [],
|
|
1194
1196
|
returnDocument: "after",
|
|
1195
1197
|
session: this.#session ? this.#session : undefined,
|
|
1196
1198
|
}
|
package/driver/mongo/utils.ts
CHANGED
|
@@ -241,9 +241,12 @@ 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]) {
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
if (f?.type?.match(/(json|array)/) && data[f?.name] && f?.name) {
|
|
245
|
+
if (
|
|
246
|
+
f?.injectAutoId &&
|
|
247
|
+
f?.type == "array" &&
|
|
248
|
+
Array.isArray(data[f.name])
|
|
249
|
+
) {
|
|
247
250
|
data[f.name]?.map((d, index) => {
|
|
248
251
|
if (!d?._id) {
|
|
249
252
|
d._id = String(new ObjectId());
|
|
@@ -257,7 +260,6 @@ function deepSetId(col: Collection, data: any) {
|
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
|
-
|
|
261
263
|
|
|
262
264
|
if (f?.type?.match(/(relationship|media)/) && data[f.name]) {
|
|
263
265
|
if (typeof data[f.name] == "object" && !Array.isArray(data[f.name])) {
|