{"action":"created","issue":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/2768","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/2768/labels{/name}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/2768/comments","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/2768/events","html_url":"https://github.com/rethinkdb/rethinkdb/issues/2768","id":38816211,"number":2768,"title":"`.map()` on single selection","user":{"login":"Morhaus","id":1621758,"avatar_url":"https://avatars.githubusercontent.com/u/1621758?v=3","gravatar_id":"","url":"https://api.github.com/users/Morhaus","html_url":"https://github.com/Morhaus","followers_url":"https://api.github.com/users/Morhaus/followers","following_url":"https://api.github.com/users/Morhaus/following{/other_user}","gists_url":"https://api.github.com/users/Morhaus/gists{/gist_id}","starred_url":"https://api.github.com/users/Morhaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morhaus/subscriptions","organizations_url":"https://api.github.com/users/Morhaus/orgs","repos_url":"https://api.github.com/users/Morhaus/repos","events_url":"https://api.github.com/users/Morhaus/events{/privacy}","received_events_url":"https://api.github.com/users/Morhaus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/tp%3ARQL_proposal","name":"tp:RQL_proposal","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/41","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/41/labels","id":367201,"number":41,"title":"subsequent","description":"","creator":{"login":"coffeemug","id":48436,"avatar_url":"https://avatars.githubusercontent.com/u/48436?v=3","gravatar_id":"","url":"https://api.github.com/users/coffeemug","html_url":"https://github.com/coffeemug","followers_url":"https://api.github.com/users/coffeemug/followers","following_url":"https://api.github.com/users/coffeemug/following{/other_user}","gists_url":"https://api.github.com/users/coffeemug/gists{/gist_id}","starred_url":"https://api.github.com/users/coffeemug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coffeemug/subscriptions","organizations_url":"https://api.github.com/users/coffeemug/orgs","repos_url":"https://api.github.com/users/coffeemug/repos","events_url":"https://api.github.com/users/coffeemug/events{/privacy}","received_events_url":"https://api.github.com/users/coffeemug/received_events","type":"User","site_admin":false},"open_issues":301,"closed_issues":1,"state":"open","created_at":"2013-06-30T07:32:52Z","updated_at":"2015-01-13T01:04:47Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2014-07-26T11:58:27Z","updated_at":"2015-01-13T01:07:27Z","closed_at":null,"body":"Just like you can use `.merge()` on sequences and single selection, it would be nice to be able to do the same with `.map()`.\r\n\r\n```javascript\r\nr.table('Post').merge(function(post) { return {foo: true}; })\r\nr.table('Post').get(0).merge(function(post) { return {foo: true}; })\r\n\r\nr.table('Post').map(function(post) { return r.branch(post('deleted'), {deleted: true}, post); })\r\nr.table('Post').get(0).map(function(post) { return r.branch(post('deleted'), {deleted: true}, post); })\r\n```\r\n\r\nThe use case is that sometimes I have to work on an opaque query that could either be a sequence or a single selection, and while some functions work fine on both (`.merge()`, `.pluck()`), more advanced cases don't."},"comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments/69678408","html_url":"https://github.com/rethinkdb/rethinkdb/issues/2768#issuecomment-69678408","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/2768","id":69678408,"user":{"login":"danielmewes","id":505365,"avatar_url":"https://avatars.githubusercontent.com/u/505365?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmewes","html_url":"https://github.com/danielmewes","followers_url":"https://api.github.com/users/danielmewes/followers","following_url":"https://api.github.com/users/danielmewes/following{/other_user}","gists_url":"https://api.github.com/users/danielmewes/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmewes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmewes/subscriptions","organizations_url":"https://api.github.com/users/danielmewes/orgs","repos_url":"https://api.github.com/users/danielmewes/repos","events_url":"https://api.github.com/users/danielmewes/events{/privacy}","received_events_url":"https://api.github.com/users/danielmewes/received_events","type":"User","site_admin":false},"created_at":"2015-01-13T01:07:27Z","updated_at":"2015-01-13T01:07:27Z","body":"Let's improve the error message when applying `map` to a single selection as proposed (explicitly suggesting `r.do`), and leave potential other steps for later depending on how that works out."}}