Sanity Studio v3 is here. Find out more on our blog →

Match an array against another array in GROQ

By Carl Filip Matre & RD Pennell


*[_type == 'movie' && count((castMembers[].person._ref)[@ in $ids]) > 0].title

  ids: ['person_chris-pratt', 'person_noomi-rapace']

@cfmatre originally came up with this brilliant method for matching an array of items against another array in GROQ but, unfortunately, it was lost to Slack history. Here, I've adapted the query to work with the Movies DB to provide access to all members of the community!


Other schemas by authors