TracksMastering Content OperationsCoursesBetween GROQ and a hard place

Between GROQ and a hard place

Simeon Griggs
Simeon GriggsPrincipal Educator at Sanity
Last updated 1 day ago
8
Lessons

Go beyond writing data queries – filter, add functions, reshape and transform the responses. Get familiar with GROQ, the query language for Sanity data, webhooks and roles.

1. Your new favourite query language

1
Task

Why you'll learn (and love) GROQ in this course, and why not GraphQL?

2. The Vision Tool

1
Task

Vision is a plugin bundled with Sanity Studio that allows you to write GROQ queries against the current Project ID and Dataset.

3. Filters and projections

10
Tasks

Most queries begin with one character, and it means “get everything.”

4. Functions, in my queries?

4
Tasks

With GROQ you can do more than return values; you can compute and transform them from within the query.

5. Joins and subqueries

4
Tasks

When a document contains a reference it only stores the ID of that document, GROQ can resolve it

6. Chained projections

2
Tasks

Write sequential projections to transform responses into different shapes

7. Query parameters

3
Tasks

Use parameters as variables in your queries, whether they have values or not.

8. Handling missing values

3
Tasks

Named attributes in a projection will return null by default, but they don't have to.