Skip to content

Filtered List Queries

You can filter your query results. In the following examples, we have a table called students, which contains fields and relations like createdAt, firstName, email, age.

Query list of records that are filtered. Notice the filter argument.

Request

query MyQuery1 {
students(
filter: {
createdAt: {
gt: "2025-12-01T13:00:00.000Z"
},
email: {
contains: "williams"
}
}
) {
items {
id
createdAt
firstName
email
}
}
}

Response

{
"data": {
"students": {
"items": [
{
"id": "97fb89ac-e0ad-44f5-b671-24a1b751287c",
"createdAt": "2025-12-02T05:03:17.180675Z",
"firstName": "John",
"email": "john.williams@example.com"
},
{
"id": "e25c4955-7ea7-4a83-a3de-d4c7427cc9fa",
"createdAt": "2025-12-04T14:18:15.955194Z",
"firstName": "Robert",
"email": "robert.williams@example.com"
}
]
}
}
}

Conditional filters use the AND and OR keys.

When AND is specified, all filter objects must return truthy.

Request

query MyQuery1 {
students(
filter: {
AND: {
email: {
contains: "johnson"
},
isActive: {
not_equals: false
}
}
}
) {
items {
id
createdAt
firstName
email
isActive
}
}
}

Response

{
"data": {
"students": {
"items": [
{
"id": "13fcb5bf-a8a4-4e55-860f-74f425944ec0",
"createdAt": "2025-12-04T20:30:58.586321Z",
"firstName": "Mary",
"email": "mary.johnson@example.com",
"isActive": true
}
]
}
}
}

When OR is specified, at least one filter object must return truthy.

Request

query MyQuery1 {
students(
filter: {
OR: {
firstName: {
equals: "Mary"
},
lastName: {
equals: "Williams"
}
}
}
) {
items {
id
createdAt
firstName
email
isActive
}
}
}

Response