Order By field count


I have query like this:

  repositoryOwner(login:"jcubic") {
    repositories(first: 5, orderBy: {field:PUSHED_AT,direction:DESC}, isFork:false) {
      edges {
        node {
          stargazers {

it display last 5 repos that I pushed into, but I want to get repos that have most stars, there should be a way to sort by field you have selected like “node.stargazers.totalCount”


Hey @jcubic!

I agree that being able sort a connection by arbitrary edge fields like that would be really useful, but unfortunately it’s something that we can’t support efficiently in the general case.

Some sorts would require that we materialise the entire connection on our backend to sort it, which would be prohibitively expensive for large connections (such as sorting Git commit history on large repos, for instance)

However, being able to sort RepositoryConnection by stargazer count would definitely be useful - thanks for that suggestion!

We’d probably implement that by adding a STARGAZER_COUNT value to the RepositoryOrderField enum. Would that work for you?

Add your schema requests

yes, that would be great.


I want to get repos Order By stars (STARGAZER_COUNT) as well.

Hope that it’s available soon. thx.