
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeBased on your schema structure, you need to filter the columns array to only include items where the referenced document's slug matches "some-slug". Here's how to do it:
*[_type == "footerMenu"][0] {
"columns": columns[]->[ slug.current == "some-slug" ]
}Let me break down what's happening:
columns[]-> ** - This dereferences the references in your columns array, converting them from {_ref: "document-id"} to the actual document data[slug.current == "some-slug"] - This filters the dereferenced array to only include documents where the slug matchesIf you want to get all the fields from the matching column documents, you can add a projection:
*[_type == "footerMenu"][0] {
"columns": columns[]->[ slug.current == "some-slug" ] {
_id,
_type,
title,
slug
}
}Or if you want to preserve the entire footerMenu structure but only with filtered columns:
*[_type == "footerMenu"][0] {
...,
"columns": columns[]->[ slug.current == "some-slug" ]
}The key difference from your attempt is that you need to dereference first with -> and then filter with [condition], rather than trying to use a subquery with *[...] inside the projection. The reference access operator (->) handles the join for you automatically by internally executing a subquery to fetch the 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