or conditions in graph ql queries #12042
-
Is it possible to specify more complex conditions in graph ql queries? For example, I have entries that represent events. These events have a start date and an optional end date. Now I want to query all events whose start date is in the future and/or their end date. Is such a thing even possible and if so, can someone point me in the right direction? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
As long as your start & end date fields are date fields, you can query them using the date fields syntax. In GraphQL the following would get all query {
entries(section:"events", startDate:"> now", "endDate": "> now") {
title
}
} If you need to get more complex, this will get all events with a start date from now until December 1, 2022 query {
entries(section:"events", startDate:["and", "> now", "< 2022-12-01"]) {
title
}
} |
Beta Was this translation helpful? Give feedback.
As long as your start & end date fields are date fields, you can query them using the date fields syntax.
In GraphQL the following would get all
event
entries with both a start & end date in the futureIf you need to get more complex, this will get all events with a start date from now until December 1, 2022