Sort
Sort found objects
Prefix: sort
Value: Vector of sort operators
Can start the pipeline: No
Steps before: find, get, sort, limit, offset
Steps after: find, get, sort, limit, offset, update, delete
Sort operators:
- Asc -
asc(...)
- Desc -
desc(...)
Example
Input:
collection|test|:q[
find[
],
sort[
asc(value|num|),
],
];
Output:
result:ok[
response{
s|data|:objects{
test|ab8b1e57-f34b-48f5-a921-d9b8895e420b|:m{
s|name|:s|test_0|,
s|num|:n|0|,
},
test|bea8bd4f-66e6-4ff2-8e13-d4cf47ff9597|:m{
s|name|:s|test_1|,
s|num|:n|1|,
},
test|fc8516b2-a9bb-47e9-a50d-c69062a9400f|:m{
s|num|:n|2|,
s|name|:s|test_2|,
},
test|7db1109e-4db1-4bef-8b1f-ab806abb308e|:m{
s|num|:n|3|,
s|name|:s|test_3|,
},
test|db9d1e00-b418-40ba-b570-af6236fb8821|:m{
s|name|:s|test_4|,
s|num|:n|4|,
},
test|fc2b9769-ef88-40b7-93cf-966d736af951|:m{
s|num|:n|5|,
s|name|:s|test_5|,
},
test|afdc54f9-4d38-40bf-a99d-4c339d8ba217|:m{
s|num|:n|6|,
s|name|:s|test_6|,
},
test|04432679-9f31-4197-ae04-abdaf0d852b5|:m{
s|num|:n|7|,
s|name|:s|test_7|,
},
test|d0dcb28a-2722-491d-8391-e23b227f6ba4|:m{
s|name|:s|test_8|,
s|num|:n|8|,
},
test|10ea91c8-ce57-4969-84fb-72d19551a571|:m{
s|name|:s|test_9|,
s|num|:n|9|,
},
},
s|meta|:find_meta{
s|count|:n|10|,
},
},
];