GROQ versus GraphQL
In Chapter 5, Sanity's GROQ Language, in the Advanced GROQ section, we wrote a GROQ query that returned all of the events for a particular venue. Now we will compare GROQ with GraphQL.
Recalling the GROQ syntax, the desired venue was named Will's Pub
:
*[_type == "event" && venue->name == "Will's Pub"]{ name, venue->{name} }
Next, let's write the corresponding GROQ query in GraphQL:
{ allEvent(where: { venue: { name: { eq: "Will's Pub" } } } ) { name venue { name } } }
GROQ's type == "event"
equates to allEvent
, which is a function. Note...