Currently the allX types in the graphql schema supports filtering based on either eq, neq, regex or glob. I would like it to also support filtering on in and notin, like this:
query Foo {
allX(
filter: { id: { in: ['1', '2', '3'] } }
) {
....
}
}
This only works for array-type fields like tags. Looking for a string in array, like in Alxandrs example doesn't work.. Would be very neat if it did..
from now we have regex and glob
Is it possible to use an Array of ids for filtering?
I have an array of tags, which I pass in the createPage.
I wanna filter in my query so I can obtain other elements where at least one value of the tags array is found (the object in the query has also an array of ids)
Thanks!
also it seems like filtering is only "two layers deep" filters like
filter: { tags: { data: { name: { eq: "something" } } } }
it is not really clear to me whether this is intended behavior or not.
"in" keyword does not work in YAML files filtering.
"Argument \"filter\" has invalid value {short: {in: [\"react\", \"gatsbyjs\"]}}.\nIn field \"short\": In field \"in\": Unknown field.",
tags: {in: []} making the array empty returns an empty node. Also, it returns an empty array if I don't completely input all the tags
Most helpful comment
It already supports this :-) https://github.com/gatsbyjs/gatsby/blob/52e36b9994a86fc473cd2f966ab6b6f87ee8eedb/examples/using-remark/src/templates/template-tag-page.js#L39