I found a way to do what I wanted, it’s sort of clumsy but it works!
First get the unique brands:
{
distinctBrands(func: type(Stems)) @groupby(Stems.brand)
}
returns:
"distinctBrands": [
{
"@groupby": [
{
"Stems.brand": "Thomson"
},
{
"Stems.brand": "Easton"
},
{
"Stems.brand": "FSA"
},
{
"Stems.brand": "Syntace"
}
]
}
]
}
Then get the count with the filter for each brand
Thomson(func: eq(Stems.brand, "Thomson")) @filter(le(Stems.length, 99)) {
count(uid)
}
Easton(func: eq(Stems.brand, "Easton")) @filter(le(Stems.length, 99)) {
count(uid)
}
FSA(func: eq(Stems.brand, "FSA")) @filter(le(Stems.length, 99)) {
count(uid)
}
}
returns:
{
"Thomson": [
{
"count": 1
}
],
"Easton": [
{
"count": 0
}
],
"FSA": [
{
"count": 2
}
]
}