Skip to content
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

Allow $paginated queries to return the count along with the result #415

Open
Floriferous opened this issue Mar 3, 2020 · 0 comments
Open

Comments

@Floriferous
Copy link
Contributor

When you paginate a query, you usually want to know how many documents are left, or how many are available in total (when showing a pagination widget in a table for example).

To do this right now, the client needs to do 2 round-trips, and run the firewall twice, to get both info.

It would be interesting if the query could return the total count along with the results, for example:

  const cursor = Users.find(query, options);

  const results = cursor.fetch();

  if (options.limit) {
    const count = cursor.count();
    results._queryCount = count;
  }

  return results;

Maybe this is something that I could build in the meteor collections by default, instead of making grapher do this.

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