我正在努力学习理智,我只能尝试从一个包含多个字符串的对象数组中获取信息。
非常感谢!
模式
{
name: "testArray",
title: "Test Array",
type: "array",
of: [
{
name: "field",
type: "object",
title: "Field",
fields: [
{
name: "firstField",
type: "string",
title: "First String"
},
{
name: "secondField",
type: "string",
title: "Second String"
},
]
}
]
},查询

发布于 2022-11-13 08:45:32
->是一个去引用操作符.只有当我们的任何字段引用到当前数据集中的某个文档时,我们才会使用它,并且我们要求sanity为我们获取引用的文档数据。
在您的模式中,testArray字段没有引用任何文档,因此我认为您不应该使用->。我认为下面的代码应该能正常工作:
*[_type == "<schema_name>"] {
title,
testArray
}https://stackoverflow.com/questions/74212291
复制相似问题