c2-mongoose 2.1.396 → 2.1.397

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.
@@ -1,6 +1,7 @@
1
1
  export interface IForeingData {
2
2
  collectionChild: string;
3
3
  parentFieldOnChild: string;
4
+ match: any;
4
5
  }
5
6
  declare class OneToManyFlowItem {
6
7
  execute(foreings: IForeingData[], populate?: string): any[];
@@ -32,6 +32,13 @@ var OneToManyFlowItem = /** @class */ (function () {
32
32
  }
33
33
  },
34
34
  ];
35
+ if (foreing.match) {
36
+ populateClauseLookup[0].$lookup.pipeline = [
37
+ {
38
+ $match: foreing.match
39
+ },
40
+ ];
41
+ }
35
42
  collection = __spreadArray(__spreadArray([], collection, true), populateClauseLookup, true);
36
43
  var model = global.connectionMongoose.models[Object.keys(global.connectionMongoose.models).find(function (key) { return global.connectionMongoose.models[key].collection.name === foreing.collectionChild; })];
37
44
  if (model) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.396",
3
+ "version": "2.1.397",
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",
@@ -1,8 +1,10 @@
1
1
  import { camelCase } from "lodash";
2
2
  import LookupArrayFlowItem from "./LookupArrayFlowItem";
3
+ import MatchFlowItem from "./MatchFlowItem";
3
4
  export interface IForeingData {
4
5
  collectionChild: string;
5
6
  parentFieldOnChild: string;
7
+ match: any
6
8
  }
7
9
 
8
10
  class OneToManyFlowItem {
@@ -22,6 +24,14 @@ class OneToManyFlowItem {
22
24
  },
23
25
  ]
24
26
 
27
+ if (foreing.match) {
28
+ populateClauseLookup[0].$lookup.pipeline = [
29
+ {
30
+ $match:
31
+ foreing.match
32
+ },
33
+ ]
34
+ }
25
35
  collection = [...collection, ...populateClauseLookup]
26
36
 
27
37
  let model = (global as any).connectionMongoose.models[