c2-mongoose 2.1.438 → 2.1.439

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.
@@ -52,6 +52,7 @@ var MatchV3FlowItem_1 = __importDefault(require("./item/MatchV3FlowItem"));
52
52
  var PopulateV3FlowItem_1 = __importDefault(require("./item/PopulateV3FlowItem"));
53
53
  var OneToManyV3FlowItem_1 = __importDefault(require("./item/OneToManyV3FlowItem"));
54
54
  var ProjectV3FlowItem_1 = __importDefault(require("./item/ProjectV3FlowItem"));
55
+ var SortV3FlowItem_1 = __importDefault(require("./item/SortV3FlowItem"));
55
56
  var GetOneByFilterV3Flow = /** @class */ (function () {
56
57
  function GetOneByFilterV3Flow() {
57
58
  }
@@ -70,7 +71,9 @@ var GetOneByFilterV3Flow = /** @class */ (function () {
70
71
  pipeline = __spreadArray(__spreadArray([], pipeline, true), PopulateV3FlowItem_1.default.execute(params.populate, model), true);
71
72
  pipeline = __spreadArray(__spreadArray([], pipeline, true), OneToManyV3FlowItem_1.default.execute(oneToMany, params.populate), true);
72
73
  pipeline = __spreadArray(__spreadArray([], pipeline, true), MatchV3FlowItem_1.default.execute(params, model), true);
74
+ pipeline = __spreadArray(__spreadArray([], pipeline, true), SortV3FlowItem_1.default.execute(params.orderBy, params.orderSense), true);
73
75
  pipeline = __spreadArray(__spreadArray([], pipeline, true), ProjectV3FlowItem_1.default.execute(params.select), true);
76
+ pipeline = __spreadArray(__spreadArray([], pipeline, true), [{ $limit: 1 }], false);
74
77
  if ((_b = params.posSteps) === null || _b === void 0 ? void 0 : _b.length) {
75
78
  pipeline = __spreadArray(__spreadArray([], pipeline, true), params.posSteps, true);
76
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.438",
3
+ "version": "2.1.439",
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",
@@ -7,6 +7,7 @@ import { IParams } from "./SearcherV3Flow"
7
7
  import PopulateV3FlowItem from "./item/PopulateV3FlowItem"
8
8
  import OneToManyV3FlowItem from "./item/OneToManyV3FlowItem"
9
9
  import ProjectV3FlowItem from "./item/ProjectV3FlowItem"
10
+ import SortV3FlowItem from "./item/SortV3FlowItem"
10
11
 
11
12
 
12
13
 
@@ -21,7 +22,9 @@ class GetOneByFilterV3Flow {
21
22
  pipeline = [...pipeline, ...PopulateV3FlowItem.execute(params.populate, model)]
22
23
  pipeline = [...pipeline, ...OneToManyV3FlowItem.execute(oneToMany, params.populate)]
23
24
  pipeline = [...pipeline, ...MatchV3FlowItem.execute(params, model)]
25
+ pipeline = [...pipeline, ...SortV3FlowItem.execute(params.orderBy, params.orderSense)]
24
26
  pipeline = [...pipeline, ...ProjectV3FlowItem.execute(params.select)]
27
+ pipeline = [...pipeline, { $limit: 1 }]
25
28
 
26
29
  if (params.posSteps?.length) {
27
30
  pipeline = [...pipeline, ...params.posSteps]