ID Field

ID's are a system field that are generated for you and are UUID compliant.

Sample ID Query

Query

{
products {
id
}
}

Output

{
"data": {
"products": [
{
"id": "123xyz"
}
]
}
}

Filtering by Single Line

ID's are often represented by strings in JSON but they are not intended to be human readable. When filtering by IDs, it is possible to pass both 123xyz and "123xyz" as valid input.

ID filters support:

  • _not
  • _in
  • _not_in
  • _contains
  • _not_contains
  • _starts_with
  • _not_starts_with
  • _ends_with
  • _not_ends_with

id: ID

{
products(where: { id: "123xyz" }) {
id
}
}

id_not: ID

{
products(where: { id_not: "123abc" }) {
id
}
}

id_in: [ID!]

{
products(where: { id_in: ["123xyz"] }) {
id
}
}

id_not_in: [ID!]

{
products(where: { id_not_in: ["123abc"] }) {
id
}
}

id_contains: ID

{
products(where: { id_contains: "123" }) {
id
}
}

id_not_contains: ID

{
products(where: { id_not_contains: "abc" }) {
id
}
}

id_starts_with: ID

{
products(where: { id_starts_with: "123" }) {
id
}
}

id_not_starts_with: ID

{
products(where: { id_not_starts_with: "xyz" }) {
id
}
}

id_ends_with: ID

{
products(where: { id_ends_with: "xyz" }) {
id
}
}

id_not_ends_with: ID

{
products(where: { id_ends_with: "123" }) {
id
}
}

Were you expecting something more?

We are constantly contributing to our documentation, but if you spot something we're missing, let us know and we'll be sure to add it.

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy