2

I have an array of articles with array of tags with references:

_type: "article",
tags: [
 {
   _id: "123",
   _rev: "123",
   _type: "articleTag",
   key: { _type: "slug", current: "news" },
   title: "News",
   _type: "string" 
 },
 ...
],

I'm trying to create a query of all articles contains an array of several tags:

*[ _type == "article" && tags[].key.current in *["news, news2"]._id ]{...,"tags": tags[]->}

But I get en error:

No function in() defined for arguments (array, array)

TylerH
  • 20,799
  • 66
  • 75
  • 101
kizoso
  • 1,216
  • 2
  • 15
  • 30

1 Answers1

3

I got help from sanity-io-land very fast. They suggested this:

*[ _type == "article" && ("news" in tags[]->key.current || "news2" in tags[]->key.current)]{...,"tags": tags[]->}
TylerH
  • 20,799
  • 66
  • 75
  • 101
kizoso
  • 1,216
  • 2
  • 15
  • 30