SORT

Returns the elements of a collection in sorted order.

Keys & expiration · Example verified

Syntax covered here

SORT key

The case sorts a list of numeric strings into ascending numeric order without storing a destination.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> RPUSH numbers 3 1 2
3
# connection: default
> sort numbers
["1","2","3"]