Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

Using groq is there a way to resolve all references inside your data no matter how deep?

4 replies
Last updated: Dec 3, 2020

Using groq is there a way to resolve all references inside your data no matter how deep? So i don't have to manually resolve all my references ?

Nov 2, 2020, 7:15 PM

I would also like to know this. Our data is deeply nested and not a uniform shape since pages are randomly composed of many different types of objects.

Dec 1, 2020, 7:24 PM

Not at the moment I'm afraid. Recursive joining for GROQ comes up as a feature request now and then, so we're looking into it.

Dec 1, 2020, 7:48 PM

Thanks

user Y
the equivalent of
raw
in graphql would be ideal for this use case.

Dec 1, 2020, 7:50 PM

user Y
is it possible to get all data for a single document, with every reference resolved, using the doc endpoint? https://www.npmjs.com/package/@sanity/client#fetch-a-single-document we only need to fetch a single document on demand (gatsby client route), but we don't necessarily know the shape of the nested data, so being able to get everything in one simple request is the ideal outcome.

Dec 3, 2020, 3:19 PM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. Sanity.io comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Sanity.io. Free to get started, pay-as-you-go on all plans.