c2-mongoose 2.1.449 → 2.1.453
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.
|
@@ -23,32 +23,31 @@ var OneToManyV3FlowItem = /** @class */ (function () {
|
|
|
23
23
|
foreings === null || foreings === void 0 ? void 0 : foreings.forEach(function (foreing) {
|
|
24
24
|
var labeled = (0, lodash_1.camelCase)(foreing.collectionChild);
|
|
25
25
|
var populateClauseLookup = [];
|
|
26
|
-
if (foreing.match) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
26
|
+
// if (foreing.match) {
|
|
27
|
+
populateClauseLookup.push({
|
|
28
|
+
$lookup: {
|
|
29
|
+
from: foreing.collectionChild,
|
|
30
|
+
// let: { localField: '$_id' },
|
|
31
|
+
localField: "_id",
|
|
32
|
+
foreignField: foreing.parentFieldOnChild,
|
|
33
|
+
as: labeled,
|
|
34
|
+
pipeline: [
|
|
35
|
+
{
|
|
36
|
+
$match: foreing.match
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
// } else {
|
|
42
|
+
// populateClauseLookup.push({
|
|
43
|
+
// $lookup: {
|
|
44
|
+
// from: foreing.collectionChild, // The collection where user data is stored
|
|
45
|
+
// localField: "_id",
|
|
46
|
+
// foreignField: foreing.parentFieldOnChild,
|
|
47
|
+
// as: labeled
|
|
48
|
+
// }
|
|
49
|
+
// })
|
|
50
|
+
// }
|
|
52
51
|
collection = __spreadArray(__spreadArray([], collection, true), populateClauseLookup, true);
|
|
53
52
|
var model = global.connectionMongoose.models[Object.keys(global.connectionMongoose.models).find(function (key) { return global.connectionMongoose.models[key].collection.name === foreing.collectionChild; })];
|
|
54
53
|
if (model) {
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ export interface IForeingData {
|
|
|
4
4
|
collectionChild: string;
|
|
5
5
|
parentFieldOnChild: string;
|
|
6
6
|
match?: any
|
|
7
|
+
sort?: any
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
class OneToManyV3FlowItem {
|
|
@@ -14,11 +15,11 @@ class OneToManyV3FlowItem {
|
|
|
14
15
|
const labeled = camelCase(foreing.collectionChild)
|
|
15
16
|
const populateClauseLookup: any[] = []
|
|
16
17
|
|
|
17
|
-
if (foreing.match) {
|
|
18
|
+
// if (foreing.match) {
|
|
18
19
|
populateClauseLookup.push({
|
|
19
20
|
$lookup: {
|
|
20
21
|
from: foreing.collectionChild, // The collection where user data is stored
|
|
21
|
-
let: { localField: '$_id' },
|
|
22
|
+
// let: { localField: '$_id' },
|
|
22
23
|
localField: "_id",
|
|
23
24
|
foreignField: foreing.parentFieldOnChild,
|
|
24
25
|
as: labeled,
|
|
@@ -30,16 +31,16 @@ class OneToManyV3FlowItem {
|
|
|
30
31
|
]
|
|
31
32
|
}
|
|
32
33
|
})
|
|
33
|
-
} else {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
34
|
+
// } else {
|
|
35
|
+
// populateClauseLookup.push({
|
|
36
|
+
// $lookup: {
|
|
37
|
+
// from: foreing.collectionChild, // The collection where user data is stored
|
|
38
|
+
// localField: "_id",
|
|
39
|
+
// foreignField: foreing.parentFieldOnChild,
|
|
40
|
+
// as: labeled
|
|
41
|
+
// }
|
|
42
|
+
// })
|
|
43
|
+
// }
|
|
43
44
|
|
|
44
45
|
collection = [...collection, ...populateClauseLookup]
|
|
45
46
|
|