c2-mongoose 2.1.451 → 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,31 +23,22 @@ 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
|
-
var pipeline = [];
|
|
27
|
-
if (foreing.match) {
|
|
28
|
-
pipeline = __spreadArray(__spreadArray([], pipeline, true), [
|
|
29
|
-
{
|
|
30
|
-
$match: foreing.match
|
|
31
|
-
}
|
|
32
|
-
], false);
|
|
33
|
-
}
|
|
34
|
-
if (foreing.sort) {
|
|
35
|
-
pipeline = __spreadArray(__spreadArray([], pipeline, true), [
|
|
36
|
-
{ $sort: foreing.sort }
|
|
37
|
-
], false);
|
|
38
|
-
}
|
|
39
26
|
// if (foreing.match) {
|
|
40
27
|
populateClauseLookup.push({
|
|
41
28
|
$lookup: {
|
|
42
29
|
from: foreing.collectionChild,
|
|
43
|
-
let: { localField: '$_id' },
|
|
30
|
+
// let: { localField: '$_id' },
|
|
31
|
+
localField: "_id",
|
|
44
32
|
foreignField: foreing.parentFieldOnChild,
|
|
45
33
|
as: labeled,
|
|
46
|
-
pipeline:
|
|
34
|
+
pipeline: [
|
|
35
|
+
{
|
|
36
|
+
$match: foreing.match
|
|
37
|
+
},
|
|
38
|
+
]
|
|
47
39
|
}
|
|
48
40
|
});
|
|
49
|
-
// }
|
|
50
|
-
// else {
|
|
41
|
+
// } else {
|
|
51
42
|
// populateClauseLookup.push({
|
|
52
43
|
// $lookup: {
|
|
53
44
|
// from: foreing.collectionChild, // The collection where user data is stored
|
package/package.json
CHANGED
|
@@ -15,35 +15,23 @@ class OneToManyV3FlowItem {
|
|
|
15
15
|
const labeled = camelCase(foreing.collectionChild)
|
|
16
16
|
const populateClauseLookup: any[] = []
|
|
17
17
|
|
|
18
|
-
let pipeline: any[] = []
|
|
19
|
-
|
|
20
|
-
if (foreing.match) {
|
|
21
|
-
pipeline = [
|
|
22
|
-
...pipeline,
|
|
23
|
-
{
|
|
24
|
-
$match: foreing.match
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
if (foreing.sort) {
|
|
29
|
-
pipeline = [
|
|
30
|
-
...pipeline,
|
|
31
|
-
{ $sort: foreing.sort }
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
18
|
// if (foreing.match) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
19
|
+
populateClauseLookup.push({
|
|
20
|
+
$lookup: {
|
|
21
|
+
from: foreing.collectionChild, // The collection where user data is stored
|
|
22
|
+
// let: { localField: '$_id' },
|
|
23
|
+
localField: "_id",
|
|
24
|
+
foreignField: foreing.parentFieldOnChild,
|
|
25
|
+
as: labeled,
|
|
26
|
+
pipeline: [
|
|
27
|
+
{
|
|
28
|
+
$match:
|
|
29
|
+
foreing.match
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
// } else {
|
|
47
35
|
// populateClauseLookup.push({
|
|
48
36
|
// $lookup: {
|
|
49
37
|
// from: foreing.collectionChild, // The collection where user data is stored
|