Start a new topic

Problem with Aggregation/Grouping

After writing grouping on particular collection, kinvey is returning some response, it contains array of objects .my question is what that object will contain and how to parse that object in javascript

What exactly are you aggregating? Do you want to get the count of rows by parent_id, or something else? That’s not clear from the query you specified.



Either way, one of the [Kinvey.Group.* methods](http://devcenter.kinvey.com/guides/datastore#ReduceFunction) probably give you what you need.
In sql We have Group by

SELECT * FROM SDDATA GROUP BY parent_id ORDER BY DATE DESC



so how to achieve this in Kinvey. Whether it is possible in kinvey to achieve this??
Thanks for the Help Mark van Seventer.
An object will contain the key(s) (and value(s)) of the fields you group by. In addition, there might be a result field as well which contains the result of the group (i.e. sum, count, min, max, average).



For example, Kinvey.Group.count('fieldToCountBy') might return:



[{

fieldToCountBy: "value",

result: 6

}, {

fieldToCountBy: "anotherValue",

result: 1

}]
Login or Signup to post a comment