c2-mongoose 2.1.92 → 2.1.94
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.
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -195,11 +195,11 @@ var SearchFlow = /** @class */ (function () {
|
|
|
195
195
|
return __generator(this, function (_c) {
|
|
196
196
|
switch (_c.label) {
|
|
197
197
|
case 0:
|
|
198
|
-
stagesItems = __spreadArray(__spreadArray(
|
|
199
|
-
{ $match: this.filters }
|
|
200
|
-
|
|
198
|
+
stagesItems = __spreadArray(__spreadArray([
|
|
199
|
+
{ $match: this.filters },
|
|
200
|
+
(0, Utils_1.isNotEmpty)(options.unions) ? options.unions : undefined,
|
|
201
201
|
this.projection ? { $project: this.projection } : { $addFields: {} }
|
|
202
|
-
],
|
|
202
|
+
], options.pipelines, true), [
|
|
203
203
|
{ $sort: this.sort },
|
|
204
204
|
{ $skip: ((this.page - 1) * this.limit) || 0 },
|
|
205
205
|
{ $limit: this.limit },
|
|
@@ -208,9 +208,9 @@ var SearchFlow = /** @class */ (function () {
|
|
|
208
208
|
{
|
|
209
209
|
$facet: {
|
|
210
210
|
items: stagesItems,
|
|
211
|
-
paging:
|
|
212
|
-
{ $match: this.filters }
|
|
213
|
-
|
|
211
|
+
paging: [
|
|
212
|
+
{ $match: this.filters },
|
|
213
|
+
(0, Utils_1.isNotEmpty)(options.unions) ? options.unions : undefined,
|
|
214
214
|
{ $count: "total" },
|
|
215
215
|
{
|
|
216
216
|
$addFields: {
|
|
@@ -218,7 +218,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
218
218
|
limit: this.limit
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
]
|
|
221
|
+
]
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
]).session(options === null || options === void 0 ? void 0 : options.session)];
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -120,7 +120,7 @@ abstract class SearchFlow {
|
|
|
120
120
|
async searchPageable(model: mongoose.Model<any>, options: SearchOptions) {
|
|
121
121
|
let stagesItems = [
|
|
122
122
|
{ $match: this.filters },
|
|
123
|
-
|
|
123
|
+
isNotEmpty(options.unions) ? options.unions : undefined,
|
|
124
124
|
this.projection ? { $project: this.projection } : { $addFields: {} },
|
|
125
125
|
...options.pipelines,
|
|
126
126
|
{ $sort: this.sort },
|
|
@@ -135,7 +135,7 @@ abstract class SearchFlow {
|
|
|
135
135
|
items: stagesItems as any,
|
|
136
136
|
paging: [
|
|
137
137
|
{ $match: this.filters },
|
|
138
|
-
|
|
138
|
+
isNotEmpty(options.unions) ? options.unions as any : undefined,
|
|
139
139
|
{ $count: "total" },
|
|
140
140
|
{
|
|
141
141
|
$addFields:
|