c2-mongoose 2.1.247 → 2.1.248

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.
@@ -98,11 +98,13 @@ var SearcherFlow = /** @class */ (function () {
98
98
  if ((0, Utils_1.isNotEmpty)(options.unions)) {
99
99
  stagesItems.push.apply(stagesItems, options.unions);
100
100
  }
101
- stagesItems.push({ $match: this.filters });
102
- if ((0, Utils_1.isNotEmpty)(this.select)) {
103
- stagesItems.push({ $project: BuildSelectSingleFlowItem_1.default.build(this.model, this.select) });
101
+ if ((0, Utils_1.isEmpty)(options.pipelines)) {
102
+ stagesItems.push({ $match: this.filters });
103
+ if ((0, Utils_1.isNotEmpty)(this.select)) {
104
+ stagesItems.push({ $project: BuildSelectSingleFlowItem_1.default.build(this.model, this.select) });
105
+ }
106
+ stagesItems.push({ $sort: this.buildOrdenation() });
104
107
  }
105
- stagesItems.push({ $sort: this.buildOrdenation() });
106
108
  if (this.pageable === true) {
107
109
  stagesItems.push({ $skip: ((this.page - 1) * this.limit) || 0 });
108
110
  stagesItems.push({ $limit: this.limit });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.247",
3
+ "version": "2.1.248",
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",
@@ -1,7 +1,7 @@
1
1
  import moment from "moment"
2
2
  import mongoose, { ClientSession, Schema, Types } from "mongoose"
3
3
  import { SearchOptions, SearchResponse } from "../types/SearchResponse"
4
- import { isNotEmpty } from "../utils/Utils"
4
+ import { isEmpty, isNotEmpty } from "../utils/Utils"
5
5
  import BuildPopulateSingleFlowItem from "./item/BuildPopulateSingleFlowItem"
6
6
  import BuildSelectSingleFlowItem from "./item/BuildSelectSingleFlowItem"
7
7
  export interface IPopulate {
@@ -52,13 +52,15 @@ class SearcherFlow<D> {
52
52
  stagesItems.push(...options.unions)
53
53
  }
54
54
 
55
- stagesItems.push({ $match: this.filters })
56
-
57
- if (isNotEmpty(this.select)) {
58
- stagesItems.push({ $project: BuildSelectSingleFlowItem.build(this.model, this.select) })
55
+ if (isEmpty(options.pipelines)){
56
+ stagesItems.push({ $match: this.filters })
57
+
58
+ if (isNotEmpty(this.select)) {
59
+ stagesItems.push({ $project: BuildSelectSingleFlowItem.build(this.model, this.select) })
60
+ }
61
+ stagesItems.push({ $sort: this.buildOrdenation() })
59
62
  }
60
63
 
61
- stagesItems.push({ $sort: this.buildOrdenation() })
62
64
  if (this.pageable === true) {
63
65
  stagesItems.push({ $skip: ((this.page - 1) * this.limit) || 0 })
64
66
  stagesItems.push({ $limit: this.limit })