@resolveio/server-lib 4.5.6 → 4.5.8

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.
@@ -356,7 +356,7 @@ function loadReportBuilderMethods(methodManager) {
356
356
  initialGroup = { _id: {} };
357
357
  groupsRow.forEach(function (row) {
358
358
  initialGroup._id[row.id] = '$' + row.field.replace(/\.\$/g, '');
359
- initialGroup.rb_arrays_0 = { '$push': '$rb_arrays_0' };
359
+ initialGroup.rb_arrays_0 = { '$first': '$rb_arrays_0' };
360
360
  initialGroup.count = { '$sum': '$count' };
361
361
  selectedFields.filter(function (a) { return !a.fieldPath.includes('$') && a.collection_name === rootCollectionName; }).forEach(function (field) {
362
362
  if (field.leafValueType === 'Average') {
@@ -582,8 +582,8 @@ function loadReportBuilderMethods(methodManager) {
582
582
  proj_1.$addFields['rb_arrays_' + cnt + '_' + field.id].$filter.cond.$and.push({ $or: tmpOr_2 });
583
583
  }
584
584
  }
585
- zipLayers.push(proj_1);
586
585
  });
586
+ zipLayers.push(proj_1);
587
587
  proj_1 = { $addFields: {} };
588
588
  selectedFields.filter(function (a) { return a.fieldPath.split('.$').length === cnt + 2; }).forEach(function (field) {
589
589
  proj_1.$addFields['rb_arrays_' + cnt + '_' + field.id] = '$rb_arrays_' + cnt + '_' + field.id + field.fieldPath.split('.$')[cnt];
@@ -879,7 +879,7 @@ function loadReportBuilderMethods(methodManager) {
879
879
  if (initialNonSumValueProj) {
880
880
  query.push(initialNonSumValueProj);
881
881
  }
882
- if (initialGroup) {
882
+ if (selectedFields.some(function (a) { return a.fieldPath.split('.$').length > 2; })) {
883
883
  query.push({
884
884
  $unwind: {
885
885
  "path": "$rb_arrays_0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "4.5.6",
3
+ "version": "4.5.8",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {