2

我有一系列带有引用标签的文章:

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

尝试创建所有文章的查询包含多个标签的数组:

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

但我得到一个错误:No function in() defined for arguments (array, array)

4

1 回答 1

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

我很快就得到了sanity-io-land 的帮助。

于 2019-11-13T14:24:13.627 回答