Advanced GROQ
In this section, we will see how to get fields from relations, how to create our own formatted response, and finally, we will explore some built-in functions.
Getting events by venues
On a venue
page, we want to select all events at that particular venue:
*[_type == "event" && venue->name == "Will's Pub"]{ Â Â name, Â Â venue->{name} }
The result will be as follows:
[ Â Â { Â Â Â Â "name": "The Appleseed Cast", Â Â Â Â "venue": { Â Â Â Â Â Â "name": "Will's Pub" Â Â Â Â } Â Â }, Â Â { Â Â Â Â "name": "Friday Drinks", Â Â Â Â "venue": { Â Â Â Â Â Â "name": "Will's Pub" Â Â Â Â } Â Â } ]
Not that the venue
, Will&apos...