c2-mongoose 2.1.365 → 2.1.366

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.
@@ -24,6 +24,9 @@ var LookupArrayFlowItem = /** @class */ (function () {
24
24
  });
25
25
  //init code here
26
26
  var currentField = remainingPath[0], others = remainingPath.slice(1);
27
+ if (!currentField) {
28
+ return [];
29
+ }
27
30
  var currentFieldDefinition = GetFieldDefinitionFlowItem_1.default.execute(model, currentField);
28
31
  if (!currentFieldDefinition || !currentFieldDefinition.options || !currentFieldDefinition.options.ref) {
29
32
  throw new Error("[1]No reference found for populate field: ".concat([previousPath, currentField]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.365",
3
+ "version": "2.1.366",
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",
@@ -13,6 +13,10 @@ class LookupArrayFlowItem {
13
13
  //init code here
14
14
  let [currentField, ...others] = remainingPath
15
15
 
16
+ if (!currentField) {
17
+ return []
18
+ }
19
+
16
20
  let currentFieldDefinition = GetFieldDefinitionFlowItem.execute(model, currentField);
17
21
  if (!currentFieldDefinition || !currentFieldDefinition.options || !currentFieldDefinition.options.ref) {
18
22
  throw new Error(`[1]No reference found for populate field: ${[previousPath, currentField]}`);