c2-mongoose 2.1.449 → 2.1.453

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.
@@ -2,6 +2,7 @@ export interface IForeingData {
2
2
  collectionChild: string;
3
3
  parentFieldOnChild: string;
4
4
  match?: any;
5
+ sort?: any;
5
6
  }
6
7
  declare class OneToManyV3FlowItem {
7
8
  execute(foreings: IForeingData[], populate?: string): any[];
@@ -23,32 +23,31 @@ var OneToManyV3FlowItem = /** @class */ (function () {
23
23
  foreings === null || foreings === void 0 ? void 0 : foreings.forEach(function (foreing) {
24
24
  var labeled = (0, lodash_1.camelCase)(foreing.collectionChild);
25
25
  var populateClauseLookup = [];
26
- if (foreing.match) {
27
- populateClauseLookup.push({
28
- $lookup: {
29
- from: foreing.collectionChild,
30
- let: { localField: '$_id' },
31
- localField: "_id",
32
- foreignField: foreing.parentFieldOnChild,
33
- as: labeled,
34
- pipeline: [
35
- {
36
- $match: foreing.match
37
- },
38
- ]
39
- }
40
- });
41
- }
42
- else {
43
- populateClauseLookup.push({
44
- $lookup: {
45
- from: foreing.collectionChild,
46
- localField: "_id",
47
- foreignField: foreing.parentFieldOnChild,
48
- as: labeled
49
- }
50
- });
51
- }
26
+ // if (foreing.match) {
27
+ populateClauseLookup.push({
28
+ $lookup: {
29
+ from: foreing.collectionChild,
30
+ // let: { localField: '$_id' },
31
+ localField: "_id",
32
+ foreignField: foreing.parentFieldOnChild,
33
+ as: labeled,
34
+ pipeline: [
35
+ {
36
+ $match: foreing.match
37
+ },
38
+ ]
39
+ }
40
+ });
41
+ // } else {
42
+ // populateClauseLookup.push({
43
+ // $lookup: {
44
+ // from: foreing.collectionChild, // The collection where user data is stored
45
+ // localField: "_id",
46
+ // foreignField: foreing.parentFieldOnChild,
47
+ // as: labeled
48
+ // }
49
+ // })
50
+ // }
52
51
  collection = __spreadArray(__spreadArray([], collection, true), populateClauseLookup, true);
53
52
  var model = global.connectionMongoose.models[Object.keys(global.connectionMongoose.models).find(function (key) { return global.connectionMongoose.models[key].collection.name === foreing.collectionChild; })];
54
53
  if (model) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.449",
3
+ "version": "2.1.453",
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",
@@ -4,6 +4,7 @@ export interface IForeingData {
4
4
  collectionChild: string;
5
5
  parentFieldOnChild: string;
6
6
  match?: any
7
+ sort?: any
7
8
  }
8
9
 
9
10
  class OneToManyV3FlowItem {
@@ -14,11 +15,11 @@ class OneToManyV3FlowItem {
14
15
  const labeled = camelCase(foreing.collectionChild)
15
16
  const populateClauseLookup: any[] = []
16
17
 
17
- if (foreing.match) {
18
+ // if (foreing.match) {
18
19
  populateClauseLookup.push({
19
20
  $lookup: {
20
21
  from: foreing.collectionChild, // The collection where user data is stored
21
- let: { localField: '$_id' },
22
+ // let: { localField: '$_id' },
22
23
  localField: "_id",
23
24
  foreignField: foreing.parentFieldOnChild,
24
25
  as: labeled,
@@ -30,16 +31,16 @@ class OneToManyV3FlowItem {
30
31
  ]
31
32
  }
32
33
  })
33
- } else {
34
- populateClauseLookup.push({
35
- $lookup: {
36
- from: foreing.collectionChild, // The collection where user data is stored
37
- localField: "_id",
38
- foreignField: foreing.parentFieldOnChild,
39
- as: labeled
40
- }
41
- })
42
- }
34
+ // } else {
35
+ // populateClauseLookup.push({
36
+ // $lookup: {
37
+ // from: foreing.collectionChild, // The collection where user data is stored
38
+ // localField: "_id",
39
+ // foreignField: foreing.parentFieldOnChild,
40
+ // as: labeled
41
+ // }
42
+ // })
43
+ // }
43
44
 
44
45
  collection = [...collection, ...populateClauseLookup]
45
46