I'm using strapi and graphQL ,
with this query i can get posts
query {
posts{
id,
title
}
}
i want to get posts and totalCount together ,desirable result would like this
{
"data": {
"totalCount" : "3",
"posts": [
{
"id": "1",
"title": "first post "
},
{
"id": "4",
"title": "post two"
},
{
"id": "5",
"title": "post 3"
}
]
}
}
I've read document and I can make a query for getting just total count but it is not enough for me ! so , How can i get posts and totalCounts together ?
I just found myself in your shoes right now and the solution I found was:
query POSTS {
postsConnection {
aggregate {
count
}
}
posts{
id
title
}
}