Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 4

GraphQL query does not work > retrieving repos with most stargazers

The following GraphQL query (which previously worked), no longer returns repositories ordered by stargazers.

 

If I run below query I get stargazers: 0 while this org has a repo with +500 stargazers. Swapping ASC with DESC gives the same result.

 

{
  organization(login: "aelfProject") {
    repositories(first: 15, orderBy: {field: STARGAZERS, direction: DESC}) {
      nodes {
        name
        stargazers {
          totalCount
        }
      }
    }
  }
}

 

 

3 Replies
Community Manager
Message 2 of 4

Re: GraphQL query does not work > retrieving repos with most stargazers

Hi @bartclaeys ,

 

Broadening the query works: Screen Shot 2019-03-16 at 11.17.14 AM.png

Thanks for being here, sharing, and keeping our community awesome!
Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 2
Message 3 of 4

Re: GraphQL query does not work > retrieving repos with most stargazers

Tried that, but ASC or DESC does not change the order.

Ground Controller Lvl 1
Message 4 of 4

Re: GraphQL query does not work > retrieving repos with most stargazers

I'm also not able to get repos ordered by stargazers to work properly.


This query (first: 5, direction: ASC): 

{
  organization(login: "wp-graphql") {
    repositories(first: 5, orderBy: {field: STARGAZERS, direction: ASC}) {
      nodes {
        name
        id
        databaseId
        stargazers {
          totalCount
        }
      }
    }
  }
}


Behaves identical to this query (first: 5, direction: ASC):

{
  organization(login: "wp-graphql") {
    repositories(first: 5, orderBy: {field: STARGAZERS, direction: DESC}) {
      nodes {
        name
        id
        databaseId
        stargazers {
          totalCount
        }
      }
    }
  }
}

 

----

Additionally, the following queries(last: 5, direction: ASC) and (last:5, direction: DESC) also behave identical to each other:

{
  organization(login: "wp-graphql") {
    repositories(last: 5, orderBy: {field: STARGAZERS, direction: DESC}) {
      nodes {
        name
        id
        databaseId
        stargazers {
          totalCount
        }
      }
    }
  }
}

 

{
  organization(login: "wp-graphql") {
    repositories(last: 5, orderBy: {field: STARGAZERS, direction: ASC}) {
      nodes {
        name
        id
        databaseId
        stargazers {
          totalCount
        }
      }
    }
  }
}