Gatsby: Enable filtering on "contains" in array

Created on 28 Jul 2017  路  7Comments  路  Source: gatsbyjs/gatsby

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'] } }
  ) {
    ....
  }
}

All 7 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3CordGuy picture 3CordGuy  路  3Comments

magicly picture magicly  路  3Comments

andykais picture andykais  路  3Comments

brandonmp picture brandonmp  路  3Comments

benstr picture benstr  路  3Comments