Reputation: 1246
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)
Upvotes: 2
Views: 2357
Reputation: 1246
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[]->}
Upvotes: 3