{"action":"created","issue":{"url":"https://api.github.com/repos/siddontang/ledisdb/issues/129","labels_url":"https://api.github.com/repos/siddontang/ledisdb/issues/129/labels{/name}","comments_url":"https://api.github.com/repos/siddontang/ledisdb/issues/129/comments","events_url":"https://api.github.com/repos/siddontang/ledisdb/issues/129/events","html_url":"https://github.com/siddontang/ledisdb/issues/129","id":56154349,"number":129,"title":"Sort command","user":{"login":"coleifer","id":119974,"avatar_url":"https://avatars.githubusercontent.com/u/119974?v=3","gravatar_id":"","url":"https://api.github.com/users/coleifer","html_url":"https://github.com/coleifer","followers_url":"https://api.github.com/users/coleifer/followers","following_url":"https://api.github.com/users/coleifer/following{/other_user}","gists_url":"https://api.github.com/users/coleifer/gists{/gist_id}","starred_url":"https://api.github.com/users/coleifer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coleifer/subscriptions","organizations_url":"https://api.github.com/users/coleifer/orgs","repos_url":"https://api.github.com/users/coleifer/repos","events_url":"https://api.github.com/users/coleifer/events{/privacy}","received_events_url":"https://api.github.com/users/coleifer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/siddontang/ledisdb/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/siddontang/ledisdb/labels/todo","name":"todo","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-01T06:32:20Z","updated_at":"2015-02-04T15:46:47Z","closed_at":null,"body":"I was curious if Ledis implemented anything like Redis' `SORT` command ([docs here](http://redis.io/commands/sort)). The `sort` command is neat because you can sort using external keys:\r\n\r\n> Sometimes you want to sort elements using external keys as weights to compare instead of comparing the actual elements in the list, set or sorted set. Let's say the list `mylist` contains the elements `1`, `2` and `3` representing unique IDs of objects stored in `object_1`, `object_2` and `object_3`. When these objects have associated weights stored in `weight_1`, `weight_2` and `weight_3`, `SORT` can be instructed to use these weights to sort `mylist` with the following statement:\r\n\r\n```\r\nSORT mylist BY weight_*\r\n```\r\n\r\n> The `BY` option takes a pattern (equal to `weight_*` in this example) that is used to generate the keys that are used for sorting. These key names are obtained substituting the first occurrence of `*` with the actual value of the element in the list (1, 2 and 3 in this example).\r\n\r\nEven crazier is the fact that you can use hashes (via the ``->`` operator). An example might be you have a set of object IDs. These object IDs correspond to hashes, and you'd like to sort the object IDs based on a value in the corresponding hash:\r\n\r\n> It is possible to use `BY` and `GET` options against hash fields with the following syntax:\r\n\r\n```\r\nSORT mylist BY weight_*->fieldname GET object_*->fieldname\r\n```\r\n\r\n> The string `->` is used to separate the key name from the hash field name. The key is substituted as documented above, and the hash stored at the resulting key is accessed to retrieve the specified hash field.\r\n\r\n---------------------------------\r\n\r\nThis is a really neat feature and I was curious if there is anything similar in LedisDB, and if not, if that's something you plan to add?\r\n\r\nThanks for your work, this is an awesome project!"},"comment":{"url":"https://api.github.com/repos/siddontang/ledisdb/issues/comments/72878160","html_url":"https://github.com/siddontang/ledisdb/issues/129#issuecomment-72878160","issue_url":"https://api.github.com/repos/siddontang/ledisdb/issues/129","id":72878160,"user":{"login":"coleifer","id":119974,"avatar_url":"https://avatars.githubusercontent.com/u/119974?v=3","gravatar_id":"","url":"https://api.github.com/users/coleifer","html_url":"https://github.com/coleifer","followers_url":"https://api.github.com/users/coleifer/followers","following_url":"https://api.github.com/users/coleifer/following{/other_user}","gists_url":"https://api.github.com/users/coleifer/gists{/gist_id}","starred_url":"https://api.github.com/users/coleifer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coleifer/subscriptions","organizations_url":"https://api.github.com/users/coleifer/orgs","repos_url":"https://api.github.com/users/coleifer/repos","events_url":"https://api.github.com/users/coleifer/events{/privacy}","received_events_url":"https://api.github.com/users/coleifer/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T15:46:47Z","updated_at":"2015-02-04T15:46:47Z","body":":+1: :100: "}}