I have a schema like this with Attribute
and Group
collections. Each attribute can reference multiple groups:
collection Attribute {
name: String
value: String
groups: Array<Ref<Group>>
index byGroup {
terms [mva(.groups)]
}
}
collection Group {
name: String
}
I’m trying to follow the docs and query all attributes which have a particular group in the array. This query works:
let group = Group.byId("402314708599701568")
group {
name,
attributes: Attribute.byGroup(group) {
name,
value
}
}
Now I wanted to convert this into a computed field. I did this:
compute attributes = ((group) => Attribute.byGroup(group))
But I get an error when I try to save the schema:
Type `{ name: String, attributes: Never, id: ID, ttl: Time | Null }` is not a subtype of `Array<Ref<Group>>`
Can anyone tell me what am I doing wrong?