descending( )


Adds a sort to a query, sorting by the specified properties in descending order.

The descending() function refines a PostsQueryBuilder to sort by the value of propertyName in descending order. You can specify multiple properties for sorting in descending order by passing each property name as an additional argument. descending() sorts the results in the order the properties are passed. You can sort the following types:

  • Number: Sorts numerically.
  • Date: Sorts by date and time.
  • String: Sorts lexicographically, so 'abc' comes after 'XYZ'. If a property contains a number stored as a string (for example, '0'), that value is sorted alphabetically and not numerically. If a property doesn't have a value, that value is ranked lowest.
Method Declaration
Copy
Method Parameters
propertyNamesArray<string>

Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.

Returns
Return Type:PostsQueryBuilder
Was this helpful?
Yes
No