Changing order from descending to ascending produces empty results in query with cascade and pagination

Report a Dgraph Bug

What version of Dgraph are you using?

Dgraph (Cloud) Version: v21.03.0-58-g17f52bc78

I’m running a particular GraphQL query that returns an empty result when changing the ordering of the elements from desc to asc. I also noticed this happens only for certain values of category. I don’t know if this might be somehow related to this issue.

This query returns results:

  queryProduct(first: 32, order: {desc: uploadedOn}, filter: {has: [currentPrice, sizes, thumbUrl]}) @cascade(fields: ["category"]) {
    id
    category(filter: {name: {eq: "Tacones"}}) {
      name
    }
  }

This one doesn’t


  queryProduct(first: 32, order: {asc: uploadedOn}, filter: {has: [currentPrice, sizes, thumbUrl]}) @cascade(fields: ["category"]) {
    id
    category(filter: {name: {eq: "Tacones"}}) {
      name
    }
  }

dgraph_bug_orderby

Expected behaviour and actual result.

The query with ascending order should also return results. It is very important in the project I’m developing to be able to change the ordering criteria without it having unexpected results, so I’d greatly appreciate any insights anyone could provide as to why this is happening.

1 Like