c2-mongoose 2.1.76 → 2.1.77

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.
@@ -60,6 +60,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
62
  var moment_1 = __importDefault(require("moment"));
63
+ var mongoose_1 = require("mongoose");
63
64
  var Environment_1 = require("../configuration/Environment");
64
65
  var Utils_1 = require("../utils/Utils");
65
66
  var SearchFlow = /** @class */ (function () {
@@ -415,6 +416,9 @@ var SearchFlow = /** @class */ (function () {
415
416
  if (['projection', 'pageable', 'order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
416
417
  return;
417
418
  }
419
+ if (key.endsWith("_id")) {
420
+ value = new mongoose_1.Types.ObjectId(value);
421
+ }
418
422
  if (value === 'true') {
419
423
  value = true;
420
424
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.76",
3
+ "version": "2.1.77",
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,5 +1,5 @@
1
1
  import moment from "moment"
2
- import mongoose, { ClientSession } from "mongoose"
2
+ import mongoose, { ClientSession, Types } from "mongoose"
3
3
  import { dbCollation } from "../configuration/Environment"
4
4
  import { Pagination, SearchOptions, SearchResponse } from "../types/SearchResponse"
5
5
  import { isEmpty, isNotEmpty } from "../utils/Utils"
@@ -309,6 +309,10 @@ abstract class SearchFlow {
309
309
  return
310
310
  }
311
311
 
312
+ if (key.endsWith("_id")) {
313
+ value = new Types.ObjectId(value as string)
314
+ }
315
+
312
316
  if (value === 'true') {
313
317
  value = true
314
318
  }