{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/sync_gateway/issues/860","labels_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/860/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/860/comments","events_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/860/events","html_url":"https://github.com/couchbase/sync_gateway/pull/860","id":76498713,"number":860,"title":"Restore support for querying reduce views through the admin API","user":{"login":"adamcfraser","id":8866453,"avatar_url":"https://avatars.githubusercontent.com/u/8866453?v=3","gravatar_id":"","url":"https://api.github.com/users/adamcfraser","html_url":"https://github.com/adamcfraser","followers_url":"https://api.github.com/users/adamcfraser/followers","following_url":"https://api.github.com/users/adamcfraser/following{/other_user}","gists_url":"https://api.github.com/users/adamcfraser/gists{/gist_id}","starred_url":"https://api.github.com/users/adamcfraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamcfraser/subscriptions","organizations_url":"https://api.github.com/users/adamcfraser/orgs","repos_url":"https://api.github.com/users/adamcfraser/repos","events_url":"https://api.github.com/users/adamcfraser/events{/privacy}","received_events_url":"https://api.github.com/users/adamcfraser/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/couchbase/sync_gateway/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"adamcfraser","id":8866453,"avatar_url":"https://avatars.githubusercontent.com/u/8866453?v=3","gravatar_id":"","url":"https://api.github.com/users/adamcfraser","html_url":"https://github.com/adamcfraser","followers_url":"https://api.github.com/users/adamcfraser/followers","following_url":"https://api.github.com/users/adamcfraser/following{/other_user}","gists_url":"https://api.github.com/users/adamcfraser/gists{/gist_id}","starred_url":"https://api.github.com/users/adamcfraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamcfraser/subscriptions","organizations_url":"https://api.github.com/users/adamcfraser/orgs","repos_url":"https://api.github.com/users/adamcfraser/repos","events_url":"https://api.github.com/users/adamcfraser/events{/privacy}","received_events_url":"https://api.github.com/users/adamcfraser/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-05-14T21:38:32Z","updated_at":"2015-05-14T22:31:05Z","closed_at":"2015-05-14T22:31:05Z","pull_request":{"url":"https://api.github.com/repos/couchbase/sync_gateway/pulls/860","html_url":"https://github.com/couchbase/sync_gateway/pull/860","diff_url":"https://github.com/couchbase/sync_gateway/pull/860.diff","patch_url":"https://github.com/couchbase/sync_gateway/pull/860.patch"},"body":"Fixes #857\r\n\r\nRestores the ability to query views with a reduce function when running queries that don't require channel filtering.  There are two scenarios where channel filtering isn't applied (and so reduce functions can be used):\r\n1. When running the query over the admin API.\r\n2. When the user running the query has access to the `*` channel\r\n\r\nIf a view with a reduce function is used in any other scenario, it returns no data and logs a warning in the Sync Gateway logs."},"comment":{"url":"https://api.github.com/repos/couchbase/sync_gateway/issues/comments/102188535","html_url":"https://github.com/couchbase/sync_gateway/pull/860#issuecomment-102188535","issue_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/860","id":102188535,"user":{"login":"adamcfraser","id":8866453,"avatar_url":"https://avatars.githubusercontent.com/u/8866453?v=3","gravatar_id":"","url":"https://api.github.com/users/adamcfraser","html_url":"https://github.com/adamcfraser","followers_url":"https://api.github.com/users/adamcfraser/followers","following_url":"https://api.github.com/users/adamcfraser/following{/other_user}","gists_url":"https://api.github.com/users/adamcfraser/gists{/gist_id}","starred_url":"https://api.github.com/users/adamcfraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamcfraser/subscriptions","organizations_url":"https://api.github.com/users/adamcfraser/orgs","repos_url":"https://api.github.com/users/adamcfraser/repos","events_url":"https://api.github.com/users/adamcfraser/events{/privacy}","received_events_url":"https://api.github.com/users/adamcfraser/received_events","type":"User","site_admin":false},"created_at":"2015-05-14T22:31:05Z","updated_at":"2015-05-14T22:31:05Z","body":"After reviewing with @snej, there are a few problems with the workaround in this PR - especially:\r\n * reduce functions that return an array (like the built-in `stats`) wouldn't work - SG would treat the first element of the array as channel filtering information\r\n * under this approach, reduce functions would have to be written to operate on the post-processed map results"}}