Groupby not allowed for predicate of list type?


#1

For predicate of list type, it seems that only the first item in the list can be grouped.


(Michel Conrado) #2

Groupby works only with edges. Not with lists.

Odd, what did you do?


#3

kind: [int]

_:A kind “10” .
_:A kind “20” .
_:B kind “10” .

@groupby(kind)
i want to get : {kind:10,count:2},{kind:20,count:1}
but only get: {kind:10,count:2}


(Michel Conrado) #4

If you need features for lists, you need to fill up an issue in Dgraph’s GitHub. With a good argument of doing it on DB side instead of your application side, examples of usage and so on. If it gets traction, surely it will have a good priority.


(August Hell) #5

Ough, that’s a good hint. Still struggeling with @groupby :woozy_face:
In the sql world groupby and having are such nice tools to limit the results of multiple joins for what you want. In graphql± its seems to me, it’s either just limited or something completely different, laughing.
I’ll try it the next days to see, if I can get more used to it.