Count Queries in GraphQL

Yes, its possible.

Example:
For the schema,

type Post {                                                                     
    id: ID!                                                                     
    title: String! @search                                                      
    text: String                                                                
}                                                                               
                                                                                
type Author {                                                                   
    id: ID!                                                                     
    name: String! @search                                                       
    posts: [Post!]                                                              
} 

The following query will show for all authors, the count of posts which are not equal to "0x2" ,

query{
  queryAuthor{
    postsAggregate(filter:{not:{id:["0x2"]}}){
      count
    }
  }
}
1 Like