Watch a live product demo 👀 See how Sanity powers richer commerce experiences

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