c2-mongoose 2.1.255 → 2.1.257

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.
@@ -239,7 +239,7 @@ var SearcherFlow = /** @class */ (function () {
239
239
  ].includes(key)) {
240
240
  return;
241
241
  }
242
- if (typeof value === 'string' && _this.isValidObjectId(value)) {
242
+ if (typeof value === 'string' && _this.isValidObjectId(value) && key !== 'owner') {
243
243
  value = new mongoose_1.Types.ObjectId(value);
244
244
  }
245
245
  if (value === 'true') {
@@ -27,7 +27,7 @@ var BuildPopulateSingleFlowItem = /** @class */ (function () {
27
27
  var populateLocal = this_1.buildPath(first, nested, existing2);
28
28
  //EXISTE UMA LIMITACAO DE SELECT A PARTIR DO 3 NIVEL DENTRO DOS CAMPO POPULATE, MELHORAR O CODIGO ABAIXO PARA PERCORRER MAIS NIVEIS
29
29
  if (Array.isArray(selectsStr)) {
30
- var allSelectOfPopulate = selectsStr.filter(function (sel) { return sel.startsWith("".concat(populateLocal.path, ".")); });
30
+ var allSelectOfPopulate = selectsStr.filter(function (sel) { return sel.startsWith("".concat(first, ".").concat(populateLocal.path)); });
31
31
  var firstLevelSelect = allSelectOfPopulate.map(function (sel) { return sel.split(".")[1].trim(); });
32
32
  var select = Array.from(new Set(firstLevelSelect)).join(" ").trim();
33
33
  if ((0, Utils_1.isNotEmpty)(select)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.255",
3
+ "version": "2.1.257",
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",
@@ -203,7 +203,7 @@ class SearcherFlow<D> {
203
203
  return
204
204
  }
205
205
 
206
- if (typeof value === 'string' && this.isValidObjectId(value as string)) {
206
+ if (typeof value === 'string' && this.isValidObjectId(value as string) && key !== 'owner') {
207
207
  value = new Types.ObjectId(value as string)
208
208
  }
209
209
 
@@ -20,7 +20,7 @@ class BuildPopulateSingleFlowItem {
20
20
 
21
21
  //EXISTE UMA LIMITACAO DE SELECT A PARTIR DO 3 NIVEL DENTRO DOS CAMPO POPULATE, MELHORAR O CODIGO ABAIXO PARA PERCORRER MAIS NIVEIS
22
22
  if (Array.isArray(selectsStr)) {
23
- let allSelectOfPopulate = (selectsStr as []).filter((sel: string) => sel.startsWith(`${populateLocal.path}.`))
23
+ let allSelectOfPopulate = (selectsStr as []).filter((sel: string) => sel.startsWith(`${first}.${populateLocal.path}`))
24
24
  let firstLevelSelect = allSelectOfPopulate.map((sel: string) => sel.split(".")[1].trim())
25
25
  let select = Array.from(new Set(firstLevelSelect)).join(" ").trim()
26
26
  if (isNotEmpty(select)) {