如何使用prismic graphql api按链接文档/关系的uid进行过滤?
我试图按类别、uid列出一组文章,我假设我必须使用如何使用prismic graphql api按链接文档/关系的uid进行过滤?,graphql,prismic.io,Graphql,Prismic.io,我试图按类别、uid列出一组文章,我假设我必须使用where查询,但我无法在链接文档中使用该查询 问题似乎是其中只接受字段上的字符串,但对于链接文档,您需要深入到uid字段 我不确定我是否使用了错误的查询,但在文档中很难找到任何帮助我的东西 我试着挖掘类别对象: { allDirectoryServices( where: { category: { _meta: { uid: "developers" } } } ) { edges { node {
where
查询,但我无法在链接文档中使用该查询
问题似乎是其中
只接受字段上的字符串,但对于链接文档,您需要深入到uid字段
我不确定我是否使用了错误的查询,但在文档中很难找到任何帮助我的东西
我试着挖掘类别对象:
{
allDirectoryServices(
where: { category: { _meta: { uid: "developers" } } }
) {
edges {
node {
name
city
region
country
category {
...on DirectoryTaxonomy {
_meta {
uid
}
name
}
}
}
}
}
}
但这将返回一个错误,它需要一个字符串:
"message": "Expected type String, found {_meta: {uid: \"developers\"}}.",
显然,这没有返回任何结果。我也在Prismic Slack组上问了这个问题,并从他们那里得到了答案: 为了通过这样的内容关系/链接字段进行查询,您需要使用文档ID
where:{category:“WBsLfioAABNUo9Kk”}
不幸的是,无法通过UID(或任何其他字段)进行查询
我想他们会很快更新他们的文档,因为这不在其中
多亏了棱镜的家伙们
{
allDirectoryServices(
where: { category: "developers"}
) {
edges {
node {
name
city
region
country
category {
...on DirectoryTaxonomy {
_meta {
uid
}
name
}
}
}
}
}
}