Filter Query Results

On many collection items, you will find the following arguments:

  • limit: Limits the number of items that are returned. It does not have a default value, meaning all results are returned.
  • skip: Skips the first x items. This is useful for pagination or lazy loading.
  • where: Allows you to filter results based on field values. All values are combined with a logical AND.
    • eq: Field equals value
    • neq: Field does not equal value
    • in: Field equals one of multiple values
    • nin: Field does not equal one of multiple values
    • lt: Field is lower than value (for number types)
    • gt: Field is greater than value (for number types)
# Return the first 5 countries with a population of over 1 million.
{
  countries(limit: 5, where: {population: {gt: 1000000}}) {
    name
    population
  }
}