{"version":"1.0","type":"rich","title":"GROQ - tricks","description":"This example demonstrates a collection of GROQ query patterns for retrieving and aggregating data from a Sanity CMS dataset. The code shows how to filter and sort project milestones to find the latest status, use boolean checks to determine project completion, implement pagination for posts, and perform SQL-like grouping by counting related documents. It introduces GROQ's native aggregation functions such as `count()`, `math::sum`, `math::avg`, and `math::max` to compute statistics directly within the query language. The group-by example uses a parent-centric projection with the `references(^._id)` function to achieve relational grouping.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-29f92e4a886f206e928128a5c52af291?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}