@dnax/core 0.8.12 → 0.8.14
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/define/index.ts +2 -0
- package/driver/mongo/rest.ts +8 -2
- package/driver/mongo/utils.ts +6 -2
- package/package.json +1 -1
package/define/index.ts
CHANGED
package/driver/mongo/rest.ts
CHANGED
|
@@ -723,7 +723,10 @@ class useRest {
|
|
|
723
723
|
update = omit(update, omitUpdate);
|
|
724
724
|
|
|
725
725
|
if (update?.$set) {
|
|
726
|
-
update.$set = deepSetId(
|
|
726
|
+
update.$set = deepSetId(
|
|
727
|
+
col,
|
|
728
|
+
omit(update.$set, ["createdAt", "updatedAt"])
|
|
729
|
+
);
|
|
727
730
|
update.$set = transformAllDate(update.$set);
|
|
728
731
|
update.$set = await hashPasswordAuto(update.$set, col);
|
|
729
732
|
// data = transformAllDate(data);
|
|
@@ -973,7 +976,10 @@ class useRest {
|
|
|
973
976
|
update = omit(update, omitUpdate);
|
|
974
977
|
|
|
975
978
|
if (update.$set) {
|
|
976
|
-
update.$set = deepSetId(
|
|
979
|
+
update.$set = deepSetId(
|
|
980
|
+
col,
|
|
981
|
+
omit(update.$set, ["createdAt", "updatedAt"])
|
|
982
|
+
);
|
|
977
983
|
update.$set = transformAllDate(update.$set);
|
|
978
984
|
update.$set = await hashPasswordAuto(update.$set, col);
|
|
979
985
|
var { valid, output, error } = this.validator(
|
package/driver/mongo/utils.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { v4 } from "uuid";
|
|
|
2
2
|
import type { findParam } from "./@types";
|
|
3
3
|
import type { Actions, Collection } from "../../types";
|
|
4
4
|
import { ObjectId } from "mongodb";
|
|
5
|
-
import { mapKeys, omit } from "radash";
|
|
5
|
+
import { get, mapKeys, omit } from "radash";
|
|
6
6
|
import { getCollection, getFieldCollection } from "../../lib/collection";
|
|
7
7
|
import { isDate } from "../../utils";
|
|
8
8
|
import generateUniqueId from "generate-unique-id";
|
|
@@ -89,7 +89,11 @@ function buildPipeline(params: findParam, col?: Collection | undefined | null) {
|
|
|
89
89
|
},
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
if (
|
|
92
|
+
if (
|
|
93
|
+
!field?.relation?.hasMany &&
|
|
94
|
+
getFieldCollection(inc?.localField, col) &&
|
|
95
|
+
!inc?.unwind
|
|
96
|
+
) {
|
|
93
97
|
pipeline.push({
|
|
94
98
|
$unwind: {
|
|
95
99
|
path: `$${inc?.as || inc?.localField || field?.name}`,
|