Skip to content

Need a total count returned with GraphQL queries #1309

Open
@asselstine

Description

@asselstine

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

When querying collections, ie:

query testNodesQuery {
  testNodes(first: 10, skip: 0) {
    id
    name
  }
}

There is no way to determine the total number of query results. It's possible to page through until we reach a page where the result count is less than the first param, but it's extremely cumbersome.

What is the expected behavior?

I'd suggest a result object:

type TestNode @entity {
  id: ID!
  name: Bytes
}

type TestNodesResult {
  totalCount: Int!
  skip: Int
  first: Int
  result: [TestNode!]!
}

type Query {
  testNodes(...): TestNodesResult!
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions