Skip to content

List based filtering #1897

Answered by severussundar
ascii1010 asked this question in Q&A
Nov 22, 2023 · 4 comments · 6 replies
Discussion options

You must be logged in to vote

Hi @ascii1010, this can be achieved using the or operator.

For example: Let's say you have an entity titled book and items with ids :1, 2 and 3 needs to be selected.

Using the following filter clause will select only the items with ids equal to 1,2 or 3.

{
  books(filter: { or: [{ id: { eq: 1 } }, { id: { eq: 2 } }, { id: { eq: 3 } }] }) {
    items {
      id
      ...
    }
  }
}

For reference, here is the list of operators that are supported along with filter

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@ascii1010
Comment options

Answer selected by yorek
Comment options

You must be logged in to vote
3 replies
@severussundar
Comment options

@jaykar2020
Comment options

@severussundar
Comment options

Comment options

You must be logged in to vote
1 reply
@severussundar
Comment options

Comment options

You must be logged in to vote
1 reply
@jaykar2020
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
4 participants