Bryan Robinson
Sr. DevRel @ Algolia
Bryan is located at Michigan, United States
Find new connections in a dataset by filtering a second time on dereferenced data
*[_type == 'screening']{
title,
movie->
}[$actorId in movie.castMembers[].person._ref]
This GROQ snippet takes an $actorId
and returns screening
documents that have a reference to a movie with this actor. This is using the default movie schema and data that you can get by running sanity init
in the Sanity CLI.
The query itself comes in three parts:
*[_type == 'screening']
: Find all documents with a type of screening
{}
) to get the screening title (and any other information), and dereference the movie
information: movie->
[$actorId in movie.castMembers[].person._ref]
: Run a filter on the returned array to check if the actor's document ID is in the castMember arrayThis is an example of using GROQ for equijoins.
Sr. DevRel @ Algolia
This is a starting point for the creation of a custom string input. It recreates the basic functionality of the default string input.
Go to Custom Input: Recreated String Field StarterA query to pull the rich color data associated with an image from the Sanity Asset Pipeline
Go to GROQ query to pull data for image palette information