- Notifications
You must be signed in to change notification settings - Fork87
Description
Is your feature request related to a problem? Please describe.
I think it's way past due that Amplify supports total counts in GraphQL queries. Other GraphQL based platforms has this built in by simply addingtotalCount
(or similar) in the query and no matter the limit, they'll get back the total count in addition to the (filtered) data.
Describe the solution you'd like
This should at least work for DynamoDB backed models and of course also for search based queries that pass by ElasticSearch.
Describe alternatives you've considered
Making a Lambda function that is a field in each model using the@function
directive, but since we are both usinglistItems
andsearchItems
with filters added, the implementation is not simple as we have to reapply those filters on the lambda function for getting the correct count.
Making custom resolvers seems like another not very fun route and not very scaleable or maintainable, and once again, this should be a "out of the box one liner" to have available as a developer. With either a Lambda or some other custom resolver I'm looking at hours or days of development.
Additional context
This is a must have feature and there's not really any workaround for displaying total counts for systems with many items — at least that I know of. I read several bug reports, but none of them seems to have a simple solution. That it has not yet been developer by AWS is beyond my understanding, as pulling out counts is one of the most common things to do when developing web apps.