Aggregate count query

Many graphql services support count aggregate for relational queries.

Can I have something like this?

query {
    essays {

// returns
  "data": {
    "allUsers": [{
      "name": "Steve",
      "essays": {
        "count": 10

something like this API Reference - Query / Subscription | Hasura GraphQL Docs

Hello @rashidul0405

Yes, as an example, you can achieve the desired behaviour using the modular content field

Lets say we have a model that has a modular content field that links to a block called “block1”

And lets say the block1 has 2 fields:

Now, let’s create an example record of the “testmodel”

And finally, we can query the nested title and the count with the following query:

Let me know if that was what you were looking for!

thanks for your reply. this makes things much more complicated. doesn’t make sense.

you were thinking about using links instead of blocks?

Exactly, yes. links are relation. blocks are sort of independent something.

I see the point, yes, we can convert this request in a feature request so that we can keep track of them and come back to it in the future. Please upvote it to get a bit more attention on it. Thanks!

1 Like