Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

GROQ is a declarative language for querying and shaping collections of largely schema-less JSON documents. Dagger is a separate system with a GraphQL API for describing workflows, including container operations. They are not two names for the same tool: GROQ helps investigate linked content records; Dagger describes work to run.

What is GROQ?

GROQ stands for “Graph-Relational Object Queries.” The GROQ specification describes it as a declarative language designed to query collections of largely schema-less JSON documents. Its stated goals include filtering documents, joining information from several documents into one response, and shaping that response to suit an application.

GROQ is associated with Sanity. In that content-data setting, a query can request the fields an application needs and follow relationships between documents. Think of it as a way to examine a set of records and return a deliberately shaped result—not as a language for investigating real criminal cases. “Cold cases” here is only a metaphor for following links among records.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do GROQ queries work?

A common query begins with *, which targets the document collection. Brackets add a filter, and braces specify the fields or values to return. The specification’s compact example is:

*[id > 2]{name}

This selects documents whose id is greater than 2 and returns their name field. In other words, the filter determines which documents match; the projection determines what the result contains.

Illustrative linked-record query

The following schematic example shows how a query might filter records and shape a result that includes names reached through references:

*[_type == "incident" && status == "unsolved"]{
  title,
  openedAt,
  "linkedPeople": suspects[]->name
}

The field names and records are illustrative, not a tested dataset. The query’s intended shape is to select unsolved incident documents, return their title and opening date, and project names from referenced people into a field called linkedPeople. In a real Sanity project, the precise fields and reference syntax must match that project’s schema and the current documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How is GROQ different from GraphQL?

GROQ and GraphQL are distinct query technologies, and the names should not obscure their different contexts. The GROQ specification describes querying largely schema-less JSON documents. Dagger documents a GraphQL API used to express workflows over typed objects such as containers. A useful distinction is whether the query is selecting and shaping content records or describing operations in a workflow.

Question GROQ Dagger’s GraphQL API
What is queried or described? Collections of largely schema-less JSON documents, as described by the GROQ specification. Typed objects and workflows, such as container operations, as described in Dagger’s documentation.
What is the query for? Filtering documents, joining related information, and shaping a response. Describing work to perform and the output to return.
Typical context in these sources Content data associated with Sanity. Workflow execution, including operations on containers.

This is not a comparison of two interchangeable implementations. GROQ is not Dagger’s query language; Dagger’s documented API uses GraphQL.

What is Dagger?

Dagger is a distinct system whose API is documented through GraphQL queries and workflows. Its documentation describes queries as instructions that can, for example, download an image, execute a command, and return output. That makes Dagger relevant when the task is to express work to be carried out, rather than to select and reshape content documents.

The shared word “query” does not mean GROQ and Dagger are integrated or that one runs inside the other. The available documentation establishes their separate roles, not a direct GROQ-to-Dagger integration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What tools support GROQ?

The GROQ project repository lists ecosystem resources and implementations, including groq-js, groq-cli, a Go library, syntax highlighting, and groqfmt. These serve different needs: implementations let developers work with the language in code or from a command line, while editor support and formatting help with authoring. Check the project’s current documentation for supported versions and usage details.

For Sanity-specific querying context, see Sanity’s documentation on how queries work. The GROQ repository describes a major/revision numbering scheme: later revisions within a major version are backwards compatible with earlier revisions, while a major version introduces breaking changes. Consult the live specification and repository before relying on a particular revision; this article does not pin one as current.

Where did GROQ come from?

The GROQ specification says work on the language started in 2015 and development of the open standard started in 2019. These dates describe the project’s history, not a measure of adoption or performance. The specification credits Alexander Staubo and Simen Svale Skogsrud among its authors.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.