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

what is the recommended way to query an array of references?

3 replies
Last updated: Oct 11, 2020

what is the recommended way to query an array of references? For example right now I have a field

articles
of type array of elements with type
article
and right now I'm doing this:
	articles[]{
		'article': @->
	}
but it forces me to have everything nested under
article
which I'd like to avoid if possible

Oct 11, 2020, 1:01 PM

	articles[]->{
	  ...
	}
This will do the trick
πŸ˜€

Oct 11, 2020, 1:51 PM

	articles[]->{
	  ...
	}
This will do the trick
πŸ˜€

Oct 11, 2020, 1:51 PM

thanks! knew there had to be a concise solution there πŸ™‚

Oct 11, 2020, 2:33 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.