{"action":"created","issue":{"url":"https://api.github.com/repos/neumino/thinky/issues/320","labels_url":"https://api.github.com/repos/neumino/thinky/issues/320/labels{/name}","comments_url":"https://api.github.com/repos/neumino/thinky/issues/320/comments","events_url":"https://api.github.com/repos/neumino/thinky/issues/320/events","html_url":"https://github.com/neumino/thinky/issues/320","id":101927623,"number":320,"title":"transform getJoin results in hasAndBelongsToMany relation to array of id's instead of array of objects","user":{"login":"justingosan","id":943867,"avatar_url":"https://avatars.githubusercontent.com/u/943867?v=3","gravatar_id":"","url":"https://api.github.com/users/justingosan","html_url":"https://github.com/justingosan","followers_url":"https://api.github.com/users/justingosan/followers","following_url":"https://api.github.com/users/justingosan/following{/other_user}","gists_url":"https://api.github.com/users/justingosan/gists{/gist_id}","starred_url":"https://api.github.com/users/justingosan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justingosan/subscriptions","organizations_url":"https://api.github.com/users/justingosan/orgs","repos_url":"https://api.github.com/users/justingosan/repos","events_url":"https://api.github.com/users/justingosan/events{/privacy}","received_events_url":"https://api.github.com/users/justingosan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-19T16:00:52Z","updated_at":"2015-08-19T16:20:15Z","closed_at":null,"body":"Hi!\r\n\r\nI have this simple object (product) that has a hasAndBelongsToMany relation to another simple object (measurement). Is there any way I can transform the getJoin({measurements:true}) results to an array of measurement Ids instead of full measurement objects?\r\n\r\nI tried to use [pluck](http://rethinkdb.com/api/javascript/pluck/):\r\n```\r\nproduct.get(<product_id>).getJoin({\r\n                    measurements: {\r\n                        _apply: function(seq){\r\n                            return seq.pluck('id');\r\n                        }\r\n                    }\r\n                })\r\n```\r\nbut it throws `ReqlDriverError: `toJSON` takes 0 argument, 1 provided after:`.\r\n[without](http://rethinkdb.com/api/javascript/without/) seems to work fine but it seems pluck would be better suited for it.\r\n\r\nHere's my code for the models:\r\n```\r\nvar Measurement = thinky.createModel('Measurement', {\r\n        id: thinky.type.string(),\r\n        name: thinky.type.string(),\r\n    }, {\r\n        enforce_extra: 'remove'\r\n    });\r\n\r\nvar model = thinky.createModel('Product', {\r\n        id: thinky.type.string(),\r\n        name: thinky.type.string(),\r\n    }, {\r\n        enforce_extra: 'remove'\r\n    });\r\n\r\n    model.hasAndBelongsToMany(Measurement, 'measurements', 'id', 'id');\r\n```\r\n======\r\nAs you may have guessed. I submitted this issue prematurely and I apologize for that"},"comment":{"url":"https://api.github.com/repos/neumino/thinky/issues/comments/132674897","html_url":"https://github.com/neumino/thinky/issues/320#issuecomment-132674897","issue_url":"https://api.github.com/repos/neumino/thinky/issues/320","id":132674897,"user":{"login":"neumino","id":1461947,"avatar_url":"https://avatars.githubusercontent.com/u/1461947?v=3","gravatar_id":"","url":"https://api.github.com/users/neumino","html_url":"https://github.com/neumino","followers_url":"https://api.github.com/users/neumino/followers","following_url":"https://api.github.com/users/neumino/following{/other_user}","gists_url":"https://api.github.com/users/neumino/gists{/gist_id}","starred_url":"https://api.github.com/users/neumino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neumino/subscriptions","organizations_url":"https://api.github.com/users/neumino/orgs","repos_url":"https://api.github.com/users/neumino/repos","events_url":"https://api.github.com/users/neumino/events{/privacy}","received_events_url":"https://api.github.com/users/neumino/received_events","type":"User","site_admin":false},"created_at":"2015-08-19T16:20:14Z","updated_at":"2015-08-19T16:20:14Z","body":"This work fine for me:\r\n```\r\nvar thinky = require('./lib/thinky.js')();\r\nvar type = thinky.type;\r\n\r\nvar Measurement = thinky.createModel('Measurement', {\r\n        id: thinky.type.string(),\r\n        name: thinky.type.string(),\r\n    }, {\r\n        enforce_extra: 'remove'\r\n    });\r\n\r\nvar Product = thinky.createModel('Product', {\r\n        id: thinky.type.string(),\r\n        name: thinky.type.string(),\r\n    }, {\r\n        enforce_extra: 'remove'\r\n    });\r\n\r\nProduct.hasAndBelongsToMany(Measurement, 'measurements', 'id', 'id');\r\n\r\nvar product = new Product({name: \"foo\"});\r\nvar measurement = new Measurement({name: \"size\"});\r\nproduct.measurements = [measurement]\r\n\r\n\r\nproduct.saveAll({measurements: true}).then(function() {\r\n  return Product.get(product.id).getJoin({\r\n                      measurements: {\r\n                          _apply: function(seq){\r\n                              return seq.without('id');\r\n                          }\r\n                      }\r\n                })\r\n\r\n}).then(console.log).error(console.log);\r\n\r\n```"}}