ordered
A set or a list sorted by a field, ascending unless "descending" is given. A cloud set is ordered on the server and stays a set; a list is sorted where it is and gives a new list (the sort is stable). Numbers sort numerically, other values as text.
Runs on: either side: the compiler places the statement that calls it where the values it uses live.
Format:
ordered(set_or_list, key [, direction])
Parameters:
| Parameter | Type | Description |
|---|---|---|
| set_or_list | mixed | the cloud set, or the list of records |
| key | string | the field to sort by |
| direction | string |  [Optional]"ascending" (the default) or "descending" |
Returned Value:
| Type | Description |
|---|---|
| mixed | the ordered set or list |
Examples
latest = ordered(posts, "created_at", "descending")