{"action":"created","issue":{"url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1391","repository_url":"https://api.github.com/repos/jenssegers/laravel-mongodb","labels_url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1391/labels{/name}","comments_url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1391/comments","events_url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1391/events","html_url":"https://github.com/jenssegers/laravel-mongodb/issues/1391","id":282687899,"number":1391,"title":"Foreignkey in embeded collections and join operation","user":{"login":"Ojvar","id":16786987,"avatar_url":"https://avatars0.githubusercontent.com/u/16786987?v=4","gravatar_id":"","url":"https://api.github.com/users/Ojvar","html_url":"https://github.com/Ojvar","followers_url":"https://api.github.com/users/Ojvar/followers","following_url":"https://api.github.com/users/Ojvar/following{/other_user}","gists_url":"https://api.github.com/users/Ojvar/gists{/gist_id}","starred_url":"https://api.github.com/users/Ojvar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ojvar/subscriptions","organizations_url":"https://api.github.com/users/Ojvar/orgs","repos_url":"https://api.github.com/users/Ojvar/repos","events_url":"https://api.github.com/users/Ojvar/events{/privacy}","received_events_url":"https://api.github.com/users/Ojvar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-17T11:44:22Z","updated_at":"2017-12-28T03:13:53Z","closed_at":null,"author_association":"NONE","body":"Hi guys\r\nI faced with a problem.\r\nI have below tables (or collections):\r\n  1:  \"users\" -> {id, name}\r\n  2:  \"committees\" -> {id, title, members[]}\r\n       2-1: \"members[]\" -> {user_id}                  <--- It keep only users id (just like as pivot table)\r\n\r\nexample:\r\n```\r\n\r\nusers:\r\n  id    |  name\r\n----------------------------------------------------\r\n  1     |  Alex\r\n  2     |  John\r\n\r\ncommittees:\r\n  id    |  title                       |  members\r\n----------------------------------------------------\r\n  1     |  Park Committee   |  { 1, 2 }\r\n  2     |  Pool Committee   |  { 2 }\r\n\r\n```\r\n\r\nAnd now, my question is, How can I get list of committees with \"users names\" instead of \"users ids\"\r\n\r\nI except such result: \r\n```\r\n\r\n{ id: 1, title: 'Park Committee', members: [{id: 1, name: 'Alex'}, {id: 2, name: 'John'}]},\r\n{ id: 2, title: 'Pool Committee', members: [{id: 2, name: 'John'}]},\r\n```\r\n\r\nAnd another question:\r\nI just need to store users' \"id\" field into embed collection, How?\r\n\r\nTnx"},"comment":{"url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/comments/354220547","html_url":"https://github.com/jenssegers/laravel-mongodb/issues/1391#issuecomment-354220547","issue_url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1391","id":354220547,"user":{"login":"harrysbaraini","id":5825285,"avatar_url":"https://avatars3.githubusercontent.com/u/5825285?v=4","gravatar_id":"","url":"https://api.github.com/users/harrysbaraini","html_url":"https://github.com/harrysbaraini","followers_url":"https://api.github.com/users/harrysbaraini/followers","following_url":"https://api.github.com/users/harrysbaraini/following{/other_user}","gists_url":"https://api.github.com/users/harrysbaraini/gists{/gist_id}","starred_url":"https://api.github.com/users/harrysbaraini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harrysbaraini/subscriptions","organizations_url":"https://api.github.com/users/harrysbaraini/orgs","repos_url":"https://api.github.com/users/harrysbaraini/repos","events_url":"https://api.github.com/users/harrysbaraini/events{/privacy}","received_events_url":"https://api.github.com/users/harrysbaraini/received_events","type":"User","site_admin":false},"created_at":"2017-12-28T03:13:53Z","updated_at":"2017-12-28T03:13:53Z","author_association":"NONE","body":"What you want is not embedMany but HasMany. HasMany will store only users' ids, then when you call $comittees->members you will get the info you need."}}
{"actor":{"display_login":"harrysbaraini"}}