简体   繁体   中英

Sanity query in an array of references

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" 
 },
 ...
],

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)

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

I've got help from sanity-io-land very fast.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM