c2-mongoose 2.1.451 → 2.1.455

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,29 +25,27 @@ var OneToManyV3FlowItem = /** @class */ (function () {
25
25
  var populateClauseLookup = [];
26
26
  var pipeline = [];
27
27
  if (foreing.match) {
28
- pipeline = __spreadArray(__spreadArray([], pipeline, true), [
29
- {
30
- $match: foreing.match
31
- }
32
- ], false);
28
+ pipeline.push({
29
+ $match: foreing.match
30
+ });
33
31
  }
34
32
  if (foreing.sort) {
35
- pipeline = __spreadArray(__spreadArray([], pipeline, true), [
36
- { $sort: foreing.sort }
37
- ], false);
33
+ pipeline.push({
34
+ $sort: foreing.sort
35
+ });
38
36
  }
39
37
  // if (foreing.match) {
40
38
  populateClauseLookup.push({
41
39
  $lookup: {
42
40
  from: foreing.collectionChild,
43
- let: { localField: '$_id' },
41
+ // let: { localField: '$_id' },
42
+ localField: "_id",
44
43
  foreignField: foreing.parentFieldOnChild,
45
44
  as: labeled,
46
- pipeline: pipeline
45
+ pipeline: __spreadArray([], pipeline, true)
47
46
  }
48
47
  });
49
- // }
50
- // else {
48
+ // } else {
51
49
  // populateClauseLookup.push({
52
50
  // $lookup: {
53
51
  // from: foreing.collectionChild, // The collection where user data is stored
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.451",
3
+ "version": "2.1.455",
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",
@@ -15,35 +15,32 @@ class OneToManyV3FlowItem {
15
15
  const labeled = camelCase(foreing.collectionChild)
16
16
  const populateClauseLookup: any[] = []
17
17
 
18
- let pipeline: any[] = []
18
+ const pipeline: any[] = []
19
19
 
20
20
  if (foreing.match) {
21
- pipeline = [
22
- ...pipeline,
23
- {
24
- $match: foreing.match
25
- }
26
- ]
21
+ pipeline.push({
22
+ $match: foreing.match
23
+ })
27
24
  }
25
+
28
26
  if (foreing.sort) {
29
- pipeline = [
30
- ...pipeline,
31
- { $sort: foreing.sort }
32
- ]
27
+ pipeline.push({
28
+ $sort: foreing.sort
29
+ })
33
30
  }
34
31
 
35
32
  // if (foreing.match) {
36
- populateClauseLookup.push({
37
- $lookup: {
38
- from: foreing.collectionChild, // The collection where user data is stored
39
- let: { localField: '$_id' },
40
- foreignField: foreing.parentFieldOnChild,
41
- as: labeled,
42
- pipeline: pipeline
43
- }
44
- })
45
- // }
46
- // else {
33
+ populateClauseLookup.push({
34
+ $lookup: {
35
+ from: foreing.collectionChild, // The collection where user data is stored
36
+ // let: { localField: '$_id' },
37
+ localField: "_id",
38
+ foreignField: foreing.parentFieldOnChild,
39
+ as: labeled,
40
+ pipeline: [ ...pipeline ]
41
+ }
42
+ })
43
+ // } else {
47
44
  // populateClauseLookup.push({
48
45
  // $lookup: {
49
46
  // from: foreing.collectionChild, // The collection where user data is stored