c2-mongoose 2.1.389 → 2.1.391
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.
|
@@ -33,16 +33,12 @@ var OneToManyFlowItem = /** @class */ (function () {
|
|
|
33
33
|
},
|
|
34
34
|
];
|
|
35
35
|
collection = __spreadArray(__spreadArray([], collection, true), populateClauseLookup, true);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Object.keys(mongoose.connection.models).find(
|
|
39
|
-
// key => mongoose.connection.models[key].collection.name === foreing.collectionChild
|
|
40
|
-
// )!
|
|
41
|
-
// ];
|
|
36
|
+
// const model = (global as any).connectionMongoose.model(foreing.collectionChild);
|
|
37
|
+
var model = global.connectionMongoose.models[Object.keys(global.connectionMongoose.models).find(function (key) { return global.connectionMongoose.models[key].collection.name === foreing.collectionChild; })];
|
|
42
38
|
console.info("finding", foreing.collectionChild);
|
|
43
39
|
console.info("model", model);
|
|
44
40
|
if (model) {
|
|
45
|
-
var populates = populate.
|
|
41
|
+
var populates = populate.replace(" ", "").split(",").filter(function (p) { return p.startsWith(labeled); });
|
|
46
42
|
console.info("iterate", populates);
|
|
47
43
|
for (var _i = 0, populates_1 = populates; _i < populates_1.length; _i++) {
|
|
48
44
|
var populate_1 = populates_1[_i];
|
package/package.json
CHANGED
|
@@ -25,17 +25,17 @@ class OneToManyFlowItem {
|
|
|
25
25
|
|
|
26
26
|
collection = [...collection, ...populateClauseLookup]
|
|
27
27
|
|
|
28
|
-
const model = (global as any).connectionMongoose.model(foreing.collectionChild);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
// const model = (global as any).connectionMongoose.model(foreing.collectionChild);
|
|
29
|
+
let model = (global as any).connectionMongoose.models[
|
|
30
|
+
Object.keys((global as any).connectionMongoose.models).find(
|
|
31
|
+
key => (global as any).connectionMongoose.models[key].collection.name === foreing.collectionChild
|
|
32
|
+
)!
|
|
33
|
+
];
|
|
34
34
|
console.info("finding", foreing.collectionChild)
|
|
35
35
|
console.info("model", model)
|
|
36
36
|
|
|
37
37
|
if (model) {
|
|
38
|
-
const populates = populate.
|
|
38
|
+
const populates = populate.replace(" ", "").split(",").filter((p: string) => p.startsWith(labeled))
|
|
39
39
|
|
|
40
40
|
console.info("iterate", populates)
|
|
41
41
|
for (const populate of populates) {
|