{"action":"closed","issue":{"url":"https://api.github.com/repos/quasar-analytics/quasar/issues/243","labels_url":"https://api.github.com/repos/quasar-analytics/quasar/issues/243/labels{/name}","comments_url":"https://api.github.com/repos/quasar-analytics/quasar/issues/243/comments","events_url":"https://api.github.com/repos/quasar-analytics/quasar/issues/243/events","html_url":"https://github.com/quasar-analytics/quasar/issues/243","id":40827919,"number":243,"title":"mongodb: simplify \"by\" set in $group op","user":{"login":"jdegoes","id":156745,"avatar_url":"https://avatars.githubusercontent.com/u/156745?v=3","gravatar_id":"","url":"https://api.github.com/users/jdegoes","html_url":"https://github.com/jdegoes","followers_url":"https://api.github.com/users/jdegoes/followers","following_url":"https://api.github.com/users/jdegoes/following{/other_user}","gists_url":"https://api.github.com/users/jdegoes/gists{/gist_id}","starred_url":"https://api.github.com/users/jdegoes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdegoes/subscriptions","organizations_url":"https://api.github.com/users/jdegoes/orgs","repos_url":"https://api.github.com/users/jdegoes/repos","events_url":"https://api.github.com/users/jdegoes/events{/privacy}","received_events_url":"https://api.github.com/users/jdegoes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/quasar-analytics/quasar/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2014-08-21T17:26:45Z","updated_at":"2015-12-11T16:43:43Z","closed_at":"2015-12-11T16:43:43Z","body":"The `by` set in a `$group` operation may be unnecessarily complex, having multiple constant values or combining constants with non-constants, or duplicating non-constants.\r\n\r\nThis optimization pass should simplify the `by` set by removing all redundant constants and duplicate fields. The rules are as follows:\r\n\r\n1. All constants can be coalesced to a single constant.\r\n2. If a non-constant appears together with a constant, the constant may be dropped.\r\n3. If two non-constants are identical, they can be replaced by one of them.\r\n\r\nThe `by` set always has the structure of an array of the things being grouped, but inside there, there may be other nested arrays, so the structure must be explored (or simplified prior to optimizing)."}}