Fields with a filter argument allow, as the name implies, filtering the result-set items. Use graphql introspection to see what fields support filters.

Operator reference

Operator Description Example
lt Larger than reservation_from: {lt: "2022-02-18"}
le Larger or equal reservation_from: {le: "2022-02-18"}
eq Equal reservation_from: {eq: "2022-02-18"}
in Equals to any of the values reservation_from: {in: ["2022-02-18", "2022-02-20"]}
ge Greater or equal reservation_from: {ge: "2022-02-18"}
gt Greater than reservation_from: {gt: "2022-02-18"}

Some fields may support only a subset of operators.

Examples

In these example we’ll be using root room_stays field:

room_stays(filter: RoomStayFilter): RoomStayConnection!

Filter one field

{
    room_stays(
        filter: {
            id: { in: ["nQZA3P1U1", "J0lZ3H4Ml"] }
        }
    ) {
        ...
    }
}

Here we look up specific RoomStay items by id

Filter multiple fields

When multiple fields are used, they all must match.

{
    room_stays(
        filter: {
            reservation_from: { lt: "2022-02-28" }
            reservation_to: { ge: "2022-02-18" }
        }
    ) {
        ...
    }
}

Here we look up RoomStay items that are staying between Feb 18th and Feb 28th.

Filter using multiple operators

Filters are not limited to using just one operator - any subset of the allowed operators can be used at the same time.

{
    room_stays(
        filter: {
            reservation_from: {
                le: "2022-02-27"
                ge: "2022-02-21"                
            }
        }
    ) {
        ...
    }
}

Here we look up RoomStay items that arrived between Feb 21st and Feb 27th.

Negation

Negation is done by using the the reserved not field.

{
    room_stays(
        filter: {
            reservation_from: { gt: "2022-02-18" }
            not : {
                reservationStatus: { eq: CANCELLED }
            }
        }
    ) {
        ...
    }
}
Here we find all RoomStay with arrival after Feb 18th that have not been cancelled.