Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to group on nested "array-object-properties" #7

Open
Operacy opened this issue Feb 25, 2016 · 1 comment
Open

Be able to group on nested "array-object-properties" #7

Operacy opened this issue Feb 25, 2016 · 1 comment
Assignees

Comments

@Operacy
Copy link

Operacy commented Feb 25, 2016

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) ?

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..

@reminyborg reminyborg self-assigned this Feb 25, 2016
@reminyborg
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants