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 – Build the way you think, not the way your CMS thinks

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.

Was this answer helpful?