order()
Description
The order()
method creates a Array by applying an Ordering to the
values of this Array, and returns the new Array.
An Ordering is a method that takes one or more Ordering objects to sort
a Array. An Ordering object is created by using the asc()
or
desc()
function with a field accessor:
-
asc()
: sort by the field in ascending order -
desc()
: sort by the field in descending order
The first entry in the Ordering has the highest sorting priority, with priority decreasing with each following entry.
If order()
is the last value in a query, the first page of the new
Array is returned.
The source array isn’t changed.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ordering |
Ordering |
Ordering to apply to Array values. One or more Ordering objects. Ordering objects: |
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!