
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYou're really close! The solution is to use the dereference operator -> in GROQ to resolve those references to the actual tag documents.
Here's how to modify your query:
*[_type == "story"]{
_type,
"title": author,
tags[]->
}The key is tags[]-> which does two things:
tags[] - iterates over each item in the tags array-> - dereferences each reference to fetch the actual storyTag documentThis will give you the full storyTag documents in your results. If you only want the titles (which sounds like what you need), you can be more specific:
*[_type == "story"]{
_type,
"title": author,
tags[]->{title}
}Or even cleaner, map it to just an array of title strings:
*[_type == "story"]{
_type,
"title": author,
"tagTitles": tags[]->title
}The reference access operator (->) internally executes a subquery to fetch the referenced document by its _id, replacing the reference object with the actual document data. When you combine it with array notation [] and projections, you can extract exactly the fields you need from those referenced documents.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store