c2-mongoose 2.1.321 → 2.1.322

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.
@@ -40,7 +40,7 @@ var MatchFlowItem = /** @class */ (function () {
40
40
  var key = _a[0], value = _a[1];
41
41
  if (value !== undefined || value === null) {
42
42
  if ([
43
- 'mainFilters',
43
+ 'mainFilter',
44
44
  'or',
45
45
  'filters',
46
46
  'withTotalizers',
@@ -5,7 +5,7 @@ var SortFlowItem = /** @class */ (function () {
5
5
  }
6
6
  SortFlowItem.prototype.exec = function (orderBy, orderSense) {
7
7
  var sort = {};
8
- sort[orderBy] = orderSense === "desc" ? -1 : 1;
8
+ sort[orderBy !== null && orderBy !== void 0 ? orderBy : "_id"] = orderSense === "desc" ? -1 : 1;
9
9
  return [{ $sort: sort }];
10
10
  };
11
11
  return SortFlowItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.321",
3
+ "version": "2.1.322",
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,7 +15,7 @@ class MatchFlowItem {
15
15
  Object.entries(filters).forEach(([key, value]) => {
16
16
  if (value !== undefined || value === null) {
17
17
  if ([
18
- 'mainFilters',
18
+ 'mainFilter',
19
19
  'or',
20
20
  'filters',
21
21
  'withTotalizers',
@@ -1,7 +1,7 @@
1
1
  class SortFlowItem {
2
2
  exec(orderBy: string, orderSense: string): any[] {
3
3
  let sort = {} as any
4
- sort[orderBy] = orderSense === "desc" ? -1 : 1
4
+ sort[orderBy ?? "_id"] = orderSense === "desc" ? -1 : 1
5
5
  return [{ $sort: sort }]
6
6
  }
7
7
  }