![](/img/trans.png)
[英]How do I get children count in Strapi's one-to-many relation using GraphQL?
[英]strapi & graphql : how to get total count of items?
我正在使用stripi和graphQL ,
通过这个查询,我可以得到帖子
query {
posts{
id,
title
}
}
我想将帖子和totalCount放在一起,理想的结果是这样的
{
"data": {
"totalCount" : "3",
"posts": [
{
"id": "1",
"title": "first post "
},
{
"id": "4",
"title": "post two"
},
{
"id": "5",
"title": "post 3"
}
]
}
}
我已经阅读了文档,我可以进行查询以获取总数,但这对我来说还不够! 那么,如何将帖子和totalCounts放在一起?
我刚刚发现自己现在处于您的位置,我找到的解决方案是:
query POSTS {
postsConnection {
aggregate {
count
}
}
posts{
id
title
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.