Skip to content

find is executed even when only count is requested #5

Closed
@yoadsn

Description

@yoadsn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions