{"action":"created","issue":{"url":"https://api.github.com/repos/envisioning/tdb/issues/171","repository_url":"https://api.github.com/repos/envisioning/tdb","labels_url":"https://api.github.com/repos/envisioning/tdb/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/envisioning/tdb/issues/171/comments","events_url":"https://api.github.com/repos/envisioning/tdb/issues/171/events","html_url":"https://github.com/envisioning/tdb/issues/171","id":144237130,"number":171,"title":"Counting relations on Cards","user":{"login":"rafaelcorreiapoli","id":12840136,"avatar_url":"https://avatars.githubusercontent.com/u/12840136?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelcorreiapoli","html_url":"https://github.com/rafaelcorreiapoli","followers_url":"https://api.github.com/users/rafaelcorreiapoli/followers","following_url":"https://api.github.com/users/rafaelcorreiapoli/following{/other_user}","gists_url":"https://api.github.com/users/rafaelcorreiapoli/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelcorreiapoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelcorreiapoli/subscriptions","organizations_url":"https://api.github.com/users/rafaelcorreiapoli/orgs","repos_url":"https://api.github.com/users/rafaelcorreiapoli/repos","events_url":"https://api.github.com/users/rafaelcorreiapoli/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelcorreiapoli/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/envisioning/tdb/labels/database","name":"database","color":"FFC274"},{"url":"https://api.github.com/repos/envisioning/tdb/labels/discussion","name":"discussion","color":"CC317C"},{"url":"https://api.github.com/repos/envisioning/tdb/labels/infrastructure","name":"infrastructure","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-29T11:40:53Z","updated_at":"2016-03-29T23:35:08Z","closed_at":null,"body":"We have 3 options:\r\n- Expose reactive counters through publications\r\n- Count relations in a map transformation on the server, before sending the results down to clients\r\n- Keep fields on MongoDB with counters, attach hooks on collections to update those fields and river those fields to ES. Then the search result array will have the counters as normal fields\r\n"},"comment":{"url":"https://api.github.com/repos/envisioning/tdb/issues/comments/203158642","html_url":"https://github.com/envisioning/tdb/issues/171#issuecomment-203158642","issue_url":"https://api.github.com/repos/envisioning/tdb/issues/171","id":203158642,"user":{"login":"lnmunhoz","id":4376835,"avatar_url":"https://avatars.githubusercontent.com/u/4376835?v=3","gravatar_id":"","url":"https://api.github.com/users/lnmunhoz","html_url":"https://github.com/lnmunhoz","followers_url":"https://api.github.com/users/lnmunhoz/followers","following_url":"https://api.github.com/users/lnmunhoz/following{/other_user}","gists_url":"https://api.github.com/users/lnmunhoz/gists{/gist_id}","starred_url":"https://api.github.com/users/lnmunhoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lnmunhoz/subscriptions","organizations_url":"https://api.github.com/users/lnmunhoz/orgs","repos_url":"https://api.github.com/users/lnmunhoz/repos","events_url":"https://api.github.com/users/lnmunhoz/events{/privacy}","received_events_url":"https://api.github.com/users/lnmunhoz/received_events","type":"User","site_admin":false},"created_at":"2016-03-29T23:35:08Z","updated_at":"2016-03-29T23:35:08Z","body":"Option 3 is the best. The search is not reactive at all so we should send to ES the number os relations of the documents and update them on hooks like the other fields.\r\n"}}