Open Operacy opened 8 years ago
With an array like:
var people = [ { name: 'Bill', friends: [ {name: 'John', city:'Tokyo'}, {name: 'Jane', city: 'London'} ] }, { name: 'Bob', friends: [ {name: 'Kotomi', city:'Tokyo'}, {name: 'Bruce', city: 'New York'} ] } ]
Aggsy should be able to group by friends.city - maybe by aggsy('friends.city()', people) ?
aggsy('friends.city()', people)
Returning:
{ 'Tokyo': [ { name: 'Bill', friends: [ {name: 'John', city:'Tokyo'} ] }, { name: 'Bob', friends: [ {name: 'Kotomi', city:'Tokyo'} ] } ], 'London': [ { name: 'Bill', friends: [ {name: 'Jane', city: 'London'} ] } ], 'New York': [ { name: 'Bob', friends: [ {name: 'Bruce', city: 'New York'} ] } ] }
So aggsy('friends.city(_count()), people) makes sense..
aggsy('friends.city(_count()), people)
You can already today use friends.city(_count()) as long as friends is not an array. Thinking the best way to do this would be to support: friends[].city(_count()) so that aggsy knows that an array is expected.
friends.city(_count())
friends[].city(_count())
With an array like:
Aggsy should be able to group by friends.city - maybe by
aggsy('friends.city()', people)
?Returning:
So
aggsy('friends.city(_count()), people)
makes sense..