Skip to content

Developers · Data

Querying Your Databases

Last updated 1 November 2026

This article guides you in fetching and filtering data from your database.

Fetching data from a field with GraphQL according to type

Database fields depend on their parent database table objects and are accessible in the query after mapping the field's name with the query attribute name. You can do that with the family of fields defined in our GraphQL PropertiesInterface documentation. for example:

query get_records {
  records(
    per_page: 20,
    filter: {
      table: { value: "employee" }
    }
  ) {
    results {
      query_name: property(name: "name")
      query_age: property_int(name: "age")
      query_enabled: property_boolean(name: "enabled")
    }
  }
}

Look at lines 9 to 11 in the example above and take note of the following:

  • :

    Fetches the database field labeled 'name' and returns the value as a String. This is then mapped to the 'query_name' query attribute name. The data can then be rendered on a page or used on an API endpoint.

  • :

    Fetches the database field labeled 'age' and returns the value as an Integer. The value is then mapped to the 'query_age' query attribute name. The data can then be rendered on a page or used on an API endpoint.

  • :

    Fetches the database field labeled 'enabled' and returns the value as a Boolean. The value is then mapped to the 'query_enabled' query attribute name which can then be rendered on a page or used on an API endpoint.

Filtering database fields with GraphQL

You can filter GraphQL results based on an object's database field values. All options are defined in GraphQL PropertyFilterInput. Some examples:

value - matches the value of a given field

query get_all_johns {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "name", value: "John" }]
    }
  ) {
    results {
      first_name: property(name: "name")
    }
  }
}

not_value - does not match the value of the given field.

query get_evrybody_except_johns {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "name", not_value: "John" }]
    }
  ) {
    results {
      first_name: property(name: "name")
    }
  }
}

value_int - matches the value of the given field.

query get_all_records_with_age_14 {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "age", value_int: 14 }]
    }
  ) {
    results {
      first_name: property(name: "name")
      age: property(name: "age")
    }
  }
}

value_float - matches the value of the given field.

query get_all_records_with_discount_twenty {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "discount", value_float: 0.2 }]
    }
  ) {
    results {
      first_name: property(name: "name")
      discount: property(name: "discount")
    }
  }
}

value_boolean - matches the value of the given field.

query get_all_records_with_discount {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "discount", value_boolean: true }]
    }
  ) {
    results {
      first_name: property(name: "name")
    }
  }
}

value_in - matches any value of the provided array.

query get_all_johns_and_annas {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "name", value_in: ["John", "Anna"] }]
    }
  ) {
    results {
      first_name: property(name: "name")
    }
  }
}

not_value_in - does not match any value of the provided array.

query get_everyone_except_johns_and_annas {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "name", not_value_in: ["John", "Anna"] }]
    }
  ) {
    results {
      first_name: property(name: "name")
    }
  }
}

range - available options for the range are: , , , and :

query get_all_adults_below_60 {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "age", range: { gte: "18", lt: "60" } }]
    }
  ) {
    results {
      first_name: property(name: "name")
    }
  }
}

uses ISO 8601 date-time formats, for example:

{
  name: "last_time_active",
  range: {
    lte: "2019-10-02T08:13:00",
    gte: "2019-09-01T08:13:00"
  }
}

exists

query get_all_with_name {
  records(
    per_page: 20,
    filter: {
      properties: [{ name: "name", exists: true }]
    }
  ) {
    results {
      first_name: property(name: "name")
    }
  }
}

Please note that the above examples are only valid for database fields defined in Table. To filter fields on users or profiles, see UsersFilterInput in the GraphQL reference.