c2-mongoose 2.1.221 → 2.1.223

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.
@@ -26,8 +26,9 @@ var BuildPopulateSingleFlowItem = /** @class */ (function () {
26
26
  var nested = rest.join('.');
27
27
  var populateLocal = this_1.buildPath(first, nested);
28
28
  if (Array.isArray(selectsStr)) {
29
- var selects = selectsStr.filter(function (sel) { return sel.startsWith("".concat(first, ".")); });
30
- var select = selects.map(function (sel) { return sel.split(".")[1]; }).join(" ");
29
+ var allSelectOfPopulate = selectsStr.filter(function (sel) { return sel.startsWith("".concat(first, ".")); });
30
+ var firstLevelSelect = allSelectOfPopulate.map(function (sel) { return sel.split(".")[1].trim(); });
31
+ var select = Array.from(new Set(firstLevelSelect)).join(" ").trim();
31
32
  if ((0, Utils_1.isNotEmpty)(select)) {
32
33
  populateLocal.select = select;
33
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.221",
3
+ "version": "2.1.223",
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",
@@ -17,8 +17,9 @@ class BuildPopulateSingleFlowItem {
17
17
  let populateLocal = this.buildPath(first, nested)
18
18
 
19
19
  if (Array.isArray(selectsStr)) {
20
- let selects = (selectsStr as []).filter((sel: string) => sel.startsWith(`${first}.`))
21
- let select = selects.map((sel: string) => sel.split(".")[1]).join(" ")
20
+ let allSelectOfPopulate = (selectsStr as []).filter((sel: string) => sel.startsWith(`${first}.`))
21
+ let firstLevelSelect = allSelectOfPopulate.map((sel: string) => sel.split(".")[1].trim())
22
+ let select = Array.from(new Set(firstLevelSelect)).join(" ").trim()
22
23
  if (isNotEmpty(select)) {
23
24
  populateLocal.select = select
24
25
  }