Suggestion: `$count` special query param? Where it literally just returns the number in place of `hook.result`.
See original GitHub issueWhat do you guys think about a $count
special query param? Where it literally just returns the number in place of hook.result
. The reason I ask is knowing to set $limit: 0
is a bit esoteric and feels like a hack. Plus with the new populate hook if you wanted to just get a count of the related items you can do
function(hook) {
if(hook.params.query.$count) {
hook.params.query.$limit = 0;
delete hook.params.query.$count;
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Hooks - Apollo GraphQL Docs
A GraphQL query string parsed into an AST with the gql template literal. Optional for the useQuery hook, because the query can be...
Read more >Adding filters based on the query - Algolia
Using the dashboard# · Click the Add consequence button and select Add Query Parameter. · In the input field that appears, enter the...
Read more >How to solve the React useEffect Hook's infinite loop patterns
Solve the issue of infinite loops when using the useEffect Hook in React to more smoothly utilize the Hook for your app's side...
Read more >How do I get a raw, compiled SQL query from a SQLAlchemy ...
This blogpost by Nicolas Cadou provides an updated answer. Quoting from the blog post, this is suggested and worked for me: from sqlalchemy.dialects...
Read more >4 Examples of the useState Hook - Dave Ceddia
But with hooks, the state can be any type you want – you can useState with an array, useState an object, a number,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eddyystop I’m actually trying to get the count of nested objects within a
populate
hook, like this:what about total of find