James Singleton
Senior Software Engineer at Zendesk
If you want to pass a parameter to a query that might not always be defined
*[_type == 'post' && select(
$id == null => true,
_id == $id
)]
I ran into an issue where sometimes I would be passing a parameter into a groq query that wasn't defined. For example, if you had a query param ?category=foo to help narrow down a search result. If you wanted to go back to seeing all of that search result, it would be nice (in my opinion) to not have to call a completely separate query.
Senior Software Engineer at Zendesk
Support Engineer at Sanity.io
Sometimes, you just need to migrate a document or two.
Go to Ad hoc document migrationGROQ doesn't yet include a function to match the end of a string, but we can simulate it by splitting our string on our term.
Go to Matching the end of a string in GROQSimplify your Studio experience by hiding deprecated fields when you create new documents.
Go to Hide a deprecated field in new documents