For pagination it is very useful to know the total number of records for a given query. I would like to have the augmented schema automatically generate a count query for each type.
Example:
{
Employees(
filter: { OR: [{ name_contains: "Mar" }, { email_contains: "Mar" }] }
first: 10
orderBy: [name_asc]
) {
_id
email
name
}
EmployeesCount(
filter: { OR: [{ name_contains: "Mar" }, { email_contains: "Mar" }] }
)
}
See this thread for further discussion.
Do you want the total number of _pages_ relative to the query, or just a query function on the total number of records which you can filter on?
Because if it's the later I can write up how you can create this yourself as an interim solution.
All I need is the total number of records which satisfy the query. The rest of the pagination is then very easy to calculate.
Actually GraphQL has a published standard for handling pagination, and it would be best for the augmented schema to follow that exactly.
https://graphql.org/learn/pagination/
I am looking for the same thing. We can have queries that return alot of data, and it would be nice to be able to get a count before you actually retrieve the data. Currently we are writing our own custom cypher queries for this, but it would be alot better if it could have been done with graphql syntax.
Sorry if my comment is off-topic, I'm new to graphql and grandstack.
AFAIK, there are 2 types of pagination supported by graphql, numbered pages and cursor-based. Apollo documentation also explains it nicely.
If I understand correctly, neo4j-graphql only supports numbered pages style first&offset pagination. Could we also get support for cursor-based pagination ?
Anyone had success implementing this?
Most helpful comment
Actually GraphQL has a published standard for handling pagination, and it would be best for the augmented schema to follow that exactly.
https://graphql.org/learn/pagination/