descending
If two documents have a different value of field, the one with greater value will be returned first.
If this function is called multiple times, the first call takes precedence: subsequent calls determine the order of documents when they are equal according to the first call.
Example
class User(
val name: String,
val age: Int,
)
users.find(
options = {
sort {
descending(User::age)
ascending(User::name)
}
},
filter = {}
)
Content copied to clipboard
This will return users from the oldest to the youngest. If multiple users have the same age, they are returned in the alphabetical order of their name.
See also
To return documents in ascending order.