🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Querying for documents by reference in a post and tag schema

3 replies
Last updated: May 22, 2023
Does anyone know how to query for documents by reference? I have a post document and a tag document. I want to get posts that include any of the tags in an array of tags, but I can't seem to get it to work.
i've created a gist if anyone can help. I've added the query I'm using right now, the schemas for tag and post, and the code for the request i'm making

May 22, 2023, 5:13 PM
You’ll need to do something similar to this !
May 22, 2023, 5:32 PM
thank you!
May 22, 2023, 5:51 PM
You’re welcome!
May 22, 2023, 6:50 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?