c2-mongoose 2.1.456 → 2.1.457
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.
|
@@ -25,8 +25,8 @@ var PopulateV3FlowItem = /** @class */ (function () {
|
|
|
25
25
|
var populateClauses = [];
|
|
26
26
|
populatesFields === null || populatesFields === void 0 ? void 0 : populatesFields.forEach(function (populateField) {
|
|
27
27
|
var _a, _b;
|
|
28
|
-
var _c, _d, _e, _f, _g, _h;
|
|
29
|
-
var
|
|
28
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
29
|
+
var _l = populateField.split('.'), first = _l[0], rest = _l.slice(1);
|
|
30
30
|
var fieldDefinition = GetFieldDefinitionFlowItem_1.default.execute(modelRoot, first);
|
|
31
31
|
if (!fieldDefinition)
|
|
32
32
|
return;
|
|
@@ -84,7 +84,7 @@ var PopulateV3FlowItem = /** @class */ (function () {
|
|
|
84
84
|
if (!fieldDefinition || !fieldDefinition.options || !((_h = fieldDefinition.options.type[0]) === null || _h === void 0 ? void 0 : _h.ref)) {
|
|
85
85
|
throw new Error("[1]No reference found for populate field: ".concat(populateField));
|
|
86
86
|
}
|
|
87
|
-
modelName = fieldDefinition.options.ref;
|
|
87
|
+
modelName = (_j = fieldDefinition.options.ref) !== null && _j !== void 0 ? _j : (_k = fieldDefinition.options.type[0]) === null || _k === void 0 ? void 0 : _k.ref;
|
|
88
88
|
refModel = global.connectionMongoose.model(modelName);
|
|
89
89
|
collectionName = refModel.collection.name;
|
|
90
90
|
var populateClauseLookup = [
|
package/package.json
CHANGED
|
@@ -83,7 +83,8 @@ class PopulateV3FlowItem {
|
|
|
83
83
|
if (!fieldDefinition || !fieldDefinition.options || !fieldDefinition.options.type[0]?.ref) {
|
|
84
84
|
throw new Error(`[1]No reference found for populate field: ${populateField}`);
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
|
|
87
|
+
modelName = fieldDefinition.options.ref ?? fieldDefinition.options.type[0]?.ref;
|
|
87
88
|
refModel = (global as any).connectionMongoose.model(modelName);
|
|
88
89
|
collectionName = refModel.collection.name;
|
|
89
90
|
|