c2-mongoose 2.1.75 → 2.1.76
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,7 +195,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
195
195
|
stagesItems = __spreadArray([
|
|
196
196
|
{ $match: this.filters },
|
|
197
197
|
{ $sort: this.sort },
|
|
198
|
-
{ $skip: (this.page - 1) * this.limit },
|
|
198
|
+
{ $skip: ((this.page - 1) * this.limit) || 0 },
|
|
199
199
|
{ $limit: this.limit },
|
|
200
200
|
this.projection ? { $project: this.projection } : { $addFields: {} }
|
|
201
201
|
], options.pipelines, true);
|
|
@@ -208,7 +208,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
208
208
|
{ $count: "total" },
|
|
209
209
|
{
|
|
210
210
|
$addFields: {
|
|
211
|
-
page: this.page,
|
|
211
|
+
page: this.page || 1,
|
|
212
212
|
limit: this.limit
|
|
213
213
|
}
|
|
214
214
|
}
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -119,7 +119,7 @@ abstract class SearchFlow {
|
|
|
119
119
|
let stagesItems = [
|
|
120
120
|
{ $match: this.filters },
|
|
121
121
|
{ $sort: this.sort },
|
|
122
|
-
{ $skip: (this.page - 1) * this.limit },
|
|
122
|
+
{ $skip: ((this.page - 1) * this.limit) || 0 },
|
|
123
123
|
{ $limit: this.limit },
|
|
124
124
|
this.projection ? { $project: this.projection } : { $addFields: {} },
|
|
125
125
|
...options.pipelines
|
|
@@ -136,7 +136,7 @@ abstract class SearchFlow {
|
|
|
136
136
|
{
|
|
137
137
|
$addFields:
|
|
138
138
|
{
|
|
139
|
-
page: this.page,
|
|
139
|
+
page: this.page || 1,
|
|
140
140
|
limit: this.limit
|
|
141
141
|
}
|
|
142
142
|
}
|