Skip to content

find is executed even when only count is requested #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yoadsn opened this issue Nov 18, 2016 · 0 comments
Closed

find is executed even when only count is requested #5

yoadsn opened this issue Nov 18, 2016 · 0 comments

Comments

@yoadsn
Copy link
Contributor

yoadsn commented Nov 18, 2016

This issue was split off from #4 since it represents a separate concern.

In short, even if the requested connection query contains only the count field:

query {
  someConnection {
    count
  }
}

A find would be executed against the target collection.

Suggestion from the original issue: (by @nodkz)

"But we should be sure that in resolveParams.projection do not present extended/defined by wrappers by a developer. So I thought that it is a complicated task.
I think that your suggestion is awesome! If in projection present only count field - we may safely avoiding a find.

It should be realized somehow like countPromise https://github.com/nodkz/graphql-compose-connection/blob/86ddc88dcce544e1579494072c5d7fb72ffad44a/src/connectionResolver.js#L176 and lines 112-118."

This is awaiting a PR to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant