Sorting order in GraphQL queries

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [X] Documentation issue or request

Current behavior

I am currently using the following GraphQL query to get all my data sorted by the date the entity was created:

query {
  queryMediaPageContents (orderby: "created") {
    id
    flatData {
      title
    }
  }
}

The problem is that I get it sorted in descending order while I need it in ascending order, but this option isn’t covered in API documentation:

image

Is there any way to specify sorting order?

Expected behavior

Received data is sorted in specified order.

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [X] Cloud version

Browser:

  • [X] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

I cannot reproduce it:

But you can also define the sort order like this

orderby: "created asc"
orderby: "created desc"
```
1 Like

Thank you, Sebastian!

1 Like