c2-mongoose 2.1.135 → 2.1.136

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,9 +75,12 @@ var SearchFlow = /** @class */ (function () {
75
75
  var found = false;
76
76
  for (var _i = 0, _a = this.select; _i < _a.length; _i++) {
77
77
  var field = _a[_i];
78
- if (field.indexOf(".") < 0) {
78
+ if (field.startsWith("-")) {
79
+ field = field.substring(1);
80
+ projection[field] = -1;
81
+ }
82
+ else {
79
83
  projection[field] = 1;
80
- found = true;
81
84
  }
82
85
  }
83
86
  if (found)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.135",
3
+ "version": "2.1.136",
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,9 +38,11 @@ abstract class SearchFlow {
38
38
  let projection: { [key: string]: number } = {}
39
39
  let found = false
40
40
  for (var field of this.select) {
41
- if (field.indexOf(".") < 0) {
42
- projection[field] = 1
43
- found = true
41
+ if (field.startsWith("-")) {
42
+ field = field.substring(1)
43
+ projection[field] = -1;
44
+ } else {
45
+ projection[field] = 1;
44
46
  }
45
47
  }
46
48