Skip to content

3.3 Ordination

Lucas Rocha edited this page Feb 8, 2019 · 2 revisions

For ascending order, just enter the value of the attribute. For descending sort, use the '-' character before the attribute.

Example: Retrieve the user list sorted alphabetically by name.

http://localhost:3000/?sort=name

Result:

sort: { 
   "name": "asc"
}

Example: Retrieve the user list sorted by age in descending order and creation date in ascending order.

http://localhost:3000/?sort=-age,created_at

Result:

sort: { 
   "age": "desc",
   "created_at": "asc"
}
Clone this wiki locally