c2-mongoose 2.1.35 → 2.1.37

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.
@@ -220,7 +220,7 @@ var SearchFlow = /** @class */ (function () {
220
220
  sort = this.buildOrdenation();
221
221
  return [4 /*yield*/, model.aggregate([
222
222
  {
223
- '$match': this.filters
223
+ $match: this.filters
224
224
  },
225
225
  {
226
226
  $group: {
@@ -232,7 +232,9 @@ var SearchFlow = /** @class */ (function () {
232
232
  },
233
233
  {
234
234
  $sort: sort
235
- }
235
+ },
236
+ { $skip: (this.page - 1) * this.limit },
237
+ { $limit: this.limit }
236
238
  ]).session(session)];
237
239
  case 1:
238
240
  ret = _a.sent();
@@ -258,14 +260,14 @@ var SearchFlow = /** @class */ (function () {
258
260
  momentValue.hour(0);
259
261
  momentValue.minute(0);
260
262
  momentValue.second(0);
261
- condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: momentValue.format("YYYY-MM-DD HH:mm") });
263
+ condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: momentValue.toDate() });
262
264
  }
263
265
  if ((0, Utils_1.isNotEmpty)(values[1])) {
264
266
  var momentValue = (0, moment_1.default)(values[1]);
265
267
  momentValue.hour(23);
266
268
  momentValue.minute(59);
267
269
  momentValue.second(59);
268
- condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: momentValue.format("YYYY-MM-DD HH:mm") });
270
+ condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: momentValue.toDate() });
269
271
  }
270
272
  filters.$and.push(condition);
271
273
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.35",
3
+ "version": "2.1.37",
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",
@@ -139,7 +139,7 @@ abstract class SearchFlow {
139
139
  const ret = await model.aggregate(
140
140
  [
141
141
  {
142
- '$match': this.filters
142
+ $match: this.filters
143
143
  },
144
144
  {
145
145
  $group: {
@@ -151,7 +151,9 @@ abstract class SearchFlow {
151
151
  },
152
152
  {
153
153
  $sort: sort
154
- }
154
+ },
155
+ { $skip: (this.page - 1) * this.limit },
156
+ { $limit: this.limit }
155
157
  ]
156
158
  ).session(session!)
157
159
  return ret
@@ -176,7 +178,7 @@ abstract class SearchFlow {
176
178
  momentValue.second(0)
177
179
  condition[fieldName] = {
178
180
  ...condition[fieldName],
179
- $gte: momentValue.format("YYYY-MM-DD HH:mm")
181
+ $gte: momentValue.toDate()
180
182
  }
181
183
  }
182
184
 
@@ -187,7 +189,7 @@ abstract class SearchFlow {
187
189
  momentValue.second(59)
188
190
  condition[fieldName] = {
189
191
  ...condition[fieldName],
190
- $lte: momentValue.format("YYYY-MM-DD HH:mm")
192
+ $lte: momentValue.toDate()
191
193
  }
192
194
  }
193
195
  filters.$and.push(condition)