New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable filtering on "contains" in array #1645

Closed
Alxandr opened this Issue Jul 28, 2017 · 6 comments

Comments

Projects
None yet
7 participants
@Alxandr

Alxandr commented Jul 28, 2017

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

This comment has been minimized.

Contributor

KyleAMathews commented Aug 5, 2017

It already supports this :-)

filter: { frontmatter: { tags: { in: [$tag] }, draft: { ne: true } } }

@oskareke

This comment has been minimized.

oskareke commented Mar 21, 2018

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..

@deemaagog

This comment has been minimized.

Member

deemaagog commented May 7, 2018

from now we have regex and glob

@lmaddio

This comment has been minimized.

lmaddio commented Jun 1, 2018

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!

@heho

This comment has been minimized.

heho commented Jul 14, 2018

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.

@ljaniszewski

This comment has been minimized.

ljaniszewski commented Nov 2, 2018

"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.",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment