I propose we have the following filter functions:
-
in
- is a value ofT
in a[T]
-
intersect
- what is the value of a[T]
when intersected with a[T]
The first feature can be of course emulated by anyofterms
. The latter however, requires a lot more work.
An example is in a many-to-many relations:
type Post {
cat: [Cat]!
content: String!
}
type Cat {
posts: [Post] @hasInverse(field: cat)
}
type Interest {
name: String!
categories: [Cat]!
}
So if you want to get all Post
given an Interest
- the query in graphql looks something like this(it’s wrong):
query ($InterestName:String!) {
queryPost (filter{????}){
content
}
}
Relevant: Filter on non-scalar fields or relations (Types) - #11 by abhimanyusinghgaur