Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GROQ subquery not working as expected #27

Open
aidan-rypens opened this issue Jul 5, 2020 · 0 comments
Open

GROQ subquery not working as expected #27

aidan-rypens opened this issue Jul 5, 2020 · 0 comments

Comments

@aidan-rypens
Copy link

aidan-rypens commented Jul 5, 2020

Hello. I'm having trouble some GROQ. I would to query all the posts on my blog with a specific category.

*[_type == "post"
  && publishedAt < now() 
  && categories[]._ref in *[_type=="category" && title=="Seatr"]._id
 ]
|order(publishedAt desc){
  title,
  categories[]->{title}
}

This results in the following error:
Query error - No function in() defined for arguments (array, array)

The following line: categories[]._ref in *[_type=="category" && title=="Seatr"]._id works separately but it does not work in the GROQ above. When pasting the return value from this in there; it does however work. Am I doing something wrong? I have followed the following examples: https://www.sanity.io/docs/query-cheat-sheet#joins-e82ab8c0925b.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant