Skip to main content
You can sort by one or more fields by using the sorting parameter. The sorting parameter is an array where each item has the following options.
  • field! - The name of the field to sort by.
  • direction! - The direction to sort either ASC or DESC.
  • nulls? - Optional field to set nulls sort order NULLS_FIRST or NULLS_last
In this example we sort by title descending.
In this example we sort by completed and title.

Setting a default sort

When querying the default is based on the persistence layer. You can override the default by using the QueryOptions decorator on your DTO. You can find the documentation and an example in the QueryOptions reference.