c2-mongoose 2.1.253 → 2.1.255

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.
@@ -103,8 +103,8 @@ var SearcherFlow = /** @class */ (function () {
103
103
  if ((0, Utils_1.isNotEmpty)(this.select)) {
104
104
  stagesItems.push({ $project: BuildSelectSingleFlowItem_1.default.build(this.model, this.select) });
105
105
  }
106
- stagesItems.push({ $sort: this.buildOrdenation() });
107
106
  }
107
+ stagesItems.push({ $sort: this.buildOrdenation() });
108
108
  stagesPaging = [];
109
109
  // if (isNotEmpty(options.pipelines)) {
110
110
  // stagesPaging.push(...options.pipelines)
@@ -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(first, ".").concat(populateLocal.path)); });
30
+ var allSelectOfPopulate = selectsStr.filter(function (sel) { return sel.startsWith("".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.253",
3
+ "version": "2.1.255",
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",
@@ -58,8 +58,8 @@ class SearcherFlow<D> {
58
58
  if (isNotEmpty(this.select)) {
59
59
  stagesItems.push({ $project: BuildSelectSingleFlowItem.build(this.model, this.select) })
60
60
  }
61
- stagesItems.push({ $sort: this.buildOrdenation() })
62
61
  }
62
+ stagesItems.push({ $sort: this.buildOrdenation() })
63
63
 
64
64
  ///
65
65
  let stagesPaging: any[] = []
@@ -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(`${first}.${populateLocal.path}`))
23
+ let allSelectOfPopulate = (selectsStr as []).filter((sel: string) => sel.startsWith(`${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)) {