c2-mongoose 2.1.89 → 2.1.91

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.
@@ -324,7 +324,8 @@ var SearchFlow = /** @class */ (function () {
324
324
  case 0: return [4 /*yield*/, repository.findOne(model)
325
325
  .sort(params.sort)
326
326
  .select(params.select)
327
- .populate(params.populate)];
327
+ .populate(params.populate)
328
+ .session(params === null || params === void 0 ? void 0 : params.session)];
328
329
  case 1: return [2 /*return*/, _a.sent()];
329
330
  }
330
331
  });
@@ -420,13 +421,7 @@ var SearchFlow = /** @class */ (function () {
420
421
  if (['projection', 'pageable', 'order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
421
422
  return;
422
423
  }
423
- if (value instanceof mongoose_1.Types.ObjectId) {
424
- console.log(value, "objectiId");
425
- }
426
- if (mongoose_1.Types.ObjectId.isValid(value)) {
427
- console.log(value, "objectiId");
428
- }
429
- if (key.endsWith("_id")) {
424
+ if (typeof value === 'string' && mongoose_1.Types.ObjectId.isValid(value)) {
430
425
  value = new mongoose_1.Types.ObjectId(value);
431
426
  }
432
427
  if (value === 'true') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.89",
3
+ "version": "2.1.91",
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",
@@ -234,6 +234,7 @@ abstract class SearchFlow {
234
234
  .sort(params.sort)
235
235
  .select(params.select)
236
236
  .populate(params.populate)
237
+ .session(params?.session)
237
238
  }
238
239
 
239
240
  public async sumBy(model: mongoose.Model<any>, _sum: any, _by: any, items: any = undefined, session?: ClientSession): Promise<any[]> {
@@ -311,13 +312,7 @@ abstract class SearchFlow {
311
312
  return
312
313
  }
313
314
 
314
- if (value instanceof Types.ObjectId) {
315
- console.log(value, "objectiId")
316
- }
317
- if (Types.ObjectId.isValid(value as any)) {
318
- console.log(value, "objectiId");
319
- }
320
- if (key.endsWith("_id")) {
315
+ if (typeof value === 'string' && Types.ObjectId.isValid(value as any)) {
321
316
  value = new Types.ObjectId(value as string)
322
317
  }
323
318