c2-mongoose 2.1.327 → 2.1.328

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.
@@ -26,13 +26,22 @@ var PopulateFlowItem = /** @class */ (function () {
26
26
  if (!fieldDefinition)
27
27
  return;
28
28
  var typeFirst = fieldDefinition.instance;
29
- if (typeFirst === 'Array' || typeFirst === 'Embedded') {
30
- if (rest === null || rest === void 0 ? void 0 : rest.length) {
31
- first = [first, rest[0]].join(".");
32
- rest.splice(0, 1);
33
- fieldDefinition = modelRoot.schema.path(first);
34
- }
29
+ while ((typeFirst === 'Array' || typeFirst === 'Embedded') && (rest === null || rest === void 0 ? void 0 : rest.length)) {
30
+ first = [first, rest[0]].join(".");
31
+ rest.splice(0, 1);
32
+ fieldDefinition = modelRoot.schema.path(first);
33
+ if (!fieldDefinition)
34
+ break;
35
+ typeFirst = fieldDefinition.instance;
35
36
  }
37
+ // let typeFirst = fieldDefinition.instance
38
+ // if (typeFirst === 'Array' || typeFirst === 'Embedded') {
39
+ // if (rest?.length) {
40
+ // first = [first, rest[0]].join(".")
41
+ // rest.splice(0, 1)
42
+ // fieldDefinition = modelRoot.schema.path(first);
43
+ // }
44
+ // }
36
45
  if (!fieldDefinition || !fieldDefinition.options || !fieldDefinition.options.ref) {
37
46
  throw new Error("[1]No reference found for populate field: ".concat(populateField));
38
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.327",
3
+ "version": "2.1.328",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,16 +8,26 @@ class PopulateFlowItem {
8
8
 
9
9
 
10
10
  let fieldDefinition = modelRoot.schema.path(first);
11
+
11
12
  if (!fieldDefinition) return
12
- let typeFirst = fieldDefinition.instance
13
13
 
14
- if (typeFirst === 'Array' || typeFirst === 'Embedded') {
15
- if (rest?.length) {
16
- first = [first, rest[0]].join(".")
17
- rest.splice(0, 1)
18
- fieldDefinition = modelRoot.schema.path(first);
19
- }
14
+ let typeFirst = fieldDefinition.instance
15
+ while ((typeFirst === 'Array' || typeFirst === 'Embedded') && rest?.length) {
16
+ first = [first, rest[0]].join(".")
17
+ rest.splice(0, 1)
18
+ fieldDefinition = modelRoot.schema.path(first);
19
+ if (!fieldDefinition) break;
20
+ typeFirst = fieldDefinition.instance
20
21
  }
22
+ // let typeFirst = fieldDefinition.instance
23
+
24
+ // if (typeFirst === 'Array' || typeFirst === 'Embedded') {
25
+ // if (rest?.length) {
26
+ // first = [first, rest[0]].join(".")
27
+ // rest.splice(0, 1)
28
+ // fieldDefinition = modelRoot.schema.path(first);
29
+ // }
30
+ // }
21
31
 
22
32
  if (!fieldDefinition || !fieldDefinition.options || !fieldDefinition.options.ref) {
23
33
  throw new Error(`[1]No reference found for populate field: ${populateField}`);