c2-mongoose 2.1.140 → 2.1.141

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.
@@ -75,6 +75,7 @@ var SearchFlow = /** @class */ (function () {
75
75
  for (var _i = 0, _a = this.select; _i < _a.length; _i++) {
76
76
  var field = _a[_i];
77
77
  var include = field.startsWith("-") ? false : true;
78
+ field = field.replace("-", "");
78
79
  projection = __assign(__assign({}, projection), this.buildProjectionNested({}, field, include));
79
80
  // if (field.startsWith("-")) {
80
81
  // field = field.substring(1)
@@ -92,7 +93,7 @@ var SearchFlow = /** @class */ (function () {
92
93
  projectCurrent[first] = include ? 1 : 0;
93
94
  return projectCurrent;
94
95
  }
95
- projectCurrent[first] = this.buildProjectionNested({}, rest.join("."), include);
96
+ projectCurrent[first] = __assign(__assign({}, projectCurrent[first]), this.buildProjectionNested({}, rest.join("."), include));
96
97
  return projectCurrent;
97
98
  };
98
99
  SearchFlow.prototype.buildPopulate = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.140",
3
+ "version": "2.1.141",
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",
@@ -38,6 +38,7 @@ abstract class SearchFlow {
38
38
  let projection: any = {}
39
39
  for (var field of this.select) {
40
40
  let include = field.startsWith("-") ? false : true
41
+ field = field.replace("-", "")
41
42
  projection = {
42
43
  ...projection,
43
44
  ...this.buildProjectionNested({}, field, include)
@@ -62,8 +63,10 @@ abstract class SearchFlow {
62
63
  return projectCurrent
63
64
  }
64
65
 
65
- projectCurrent[first] = this.buildProjectionNested({}, rest.join("."), include)
66
-
66
+ projectCurrent[first] = {
67
+ ...projectCurrent[first],
68
+ ...this.buildProjectionNested({}, rest.join("."), include)
69
+ }
67
70
  return projectCurrent
68
71
  }
69
72