Hi! I’m working on a use case, which requires to be able to get the number of unique (string) literals in a connected component. For now it looks like this feature is missing. Do you see it possible to enable counting the number of unique categories after grouping nodes by a literal?
Here is an example (simplified):
I want to find out how many unique user_id’s do I have in my database, assuming user_id is a literal for the transaction node:
{
find_ids(func: has(transaction_id)) {
uids as uid
}
group_by(func: uid(uids)) @groupby(user_id) {
count( uid )
}
}
Here is the result:
“group_by”:
"@groupby": [
{
"user_id": "111",
"count": 3
},
{
"user_id": "222",
"count": 12
},
...
]
What I need, it’s just to be able to count the number of unique categories: 2 in this case. But it doesn’t seem to be possible because the current GraphQL functionality doesn’t support assigning variable to the grouped result. But maybe there is a workaround or I’m missing something.
Thanks!