Documentation
Blog post from Sanity
The GROQ syntax reference documentation provides an overview of the query language used in the Sanity data platform, detailing its structure, components, and functionalities. GROQ, a superset of JSON, allows users to query documents by filtering and projecting data based on specific criteria, using a pipeline-like approach where results from each stage feed into the next. The language supports various expressions, literals, and operators to facilitate complex queries, including attribute lookups and scope management with the use of the @ and ^ operators. Additionally, GROQ syntax accommodates comments for documentation, and its functions can process data through pipe operators for operations like ordering and scoring. The document emphasizes GROQ's flexibility in query composition, enabling users to access and manipulate data effectively in Sanity's environment.