Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

Get All Elements from an Array

6 replies
Last updated: Jan 22, 2022

Hi !
I got what I wanted data wise using this query, but I just got 1 element out of the array, I was wondering how to do the same but to get information from every element of the array:

Thanks in advance!

Jan 22, 2022, 12:27 AM

Hey there! To clarify, are you not getting all of your

or all of your
? If it's the latter, you're currently specifying
, which would only return the first index of the array.

Jan 22, 2022, 12:29 AM

This is what i’m getting. Just the first element as the query says (I did it that way cause I’m trying to get all the information, but that’s the most that I’ve got haha 😅)

Jan 22, 2022, 12:32 AM

If you remove the

, you should get all of your
array back even if you are specifying a projection.

Jan 22, 2022, 12:34 AM

When I did this:

*[type == "event"]{
It returned null for registers

Jan 22, 2022, 12:34 AM

It worked, thank you very much! 🤘

Jan 22, 2022, 12:37 AM

You're welcome!

Jan 22, 2022, 12:37 AM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.