{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1135","labels_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1135/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1135/comments","events_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1135/events","html_url":"https://github.com/couchbase/sync_gateway/issues/1135","id":106777013,"number":1135,"title":"Failed to query view by SG(1.1.0) admin rest api","user":{"login":"atom992","id":2324592,"avatar_url":"https://avatars.githubusercontent.com/u/2324592?v=3","gravatar_id":"","url":"https://api.github.com/users/atom992","html_url":"https://github.com/atom992","followers_url":"https://api.github.com/users/atom992/followers","following_url":"https://api.github.com/users/atom992/following{/other_user}","gists_url":"https://api.github.com/users/atom992/gists{/gist_id}","starred_url":"https://api.github.com/users/atom992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom992/subscriptions","organizations_url":"https://api.github.com/users/atom992/orgs","repos_url":"https://api.github.com/users/atom992/repos","events_url":"https://api.github.com/users/atom992/events{/privacy}","received_events_url":"https://api.github.com/users/atom992/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-16T13:45:46Z","updated_at":"2015-09-16T17:16:38Z","closed_at":null,"body":"Hi, I can not query the view by SG Admin API,(SG 1.1.0 + couchabse 3.1.0)\r\nI followed:\r\nhttp://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/sync-gateway/accessing-cb-views/creating-and-using-a-view/index.html\r\nand when I add the view :\r\n{\r\n\"views\":{\r\n\"all_lists\":{\r\n\"map\":\"function (doc, meta) { if (doc._sync === undefined || meta.id.substring(0,6) == \\\"_sync:\\\") { return; } if (doc.type != \\\"list\\\") { return; } emit(doc.title, doc.owner); }\"\r\n}\r\n}\r\n}\r\nI can check the view by CB web UI,and the view looks like this:\r\nfunction(doc,meta) {\r\n                    var sync = doc._sync;\r\n\r\n                    if (sync === undefined || meta.id.substring(0,6) == \"_sync:\")\r\n\r\n                      return;\r\n\r\n                    if ((sync.flags & 1) || sync.deleted)\r\n\r\n                      return;\r\n\r\n                    delete doc._sync;\r\n\r\n                    meta.rev = sync.rev;\r\n\r\n                    (function (doc, meta) { if (doc._sync === undefined || meta.id.substring(0,6) == \"_sync:\") { return; } if (doc.type != \"list\") { return; } emit(doc.title, doc.owner); }) (doc, meta); }\r\nSG add some logic into it.\r\nbut when I add some test data by:\r\ncurl -X PUT -H \"Content-type: application/json\" localhost:4985/db/lists:001 -d '{\"type\":\"list\",\"title\":\"title_test\",\"owner\":\"owner_test\"}'\r\nI can not query this data by SG admin REST API (and CB web UI) .\r\n\r\nwhen I remove \"delete doc._sync; \" in map function, and query view by add full_set=true parameter,I can get the data.\r\nI don't know what useful about \"delete doc._sync;\" and \"meta.rev = sync.rev;\"\r\nbut I still can not query my custom view by SG admin rest api.\r\nbtw, I can query the view by CB admin UI.\r\n"},"comment":{"url":"https://api.github.com/repos/couchbase/sync_gateway/issues/comments/140809478","html_url":"https://github.com/couchbase/sync_gateway/issues/1135#issuecomment-140809478","issue_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1135","id":140809478,"user":{"login":"ajres","id":7745210,"avatar_url":"https://avatars.githubusercontent.com/u/7745210?v=3","gravatar_id":"","url":"https://api.github.com/users/ajres","html_url":"https://github.com/ajres","followers_url":"https://api.github.com/users/ajres/followers","following_url":"https://api.github.com/users/ajres/following{/other_user}","gists_url":"https://api.github.com/users/ajres/gists{/gist_id}","starred_url":"https://api.github.com/users/ajres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajres/subscriptions","organizations_url":"https://api.github.com/users/ajres/orgs","repos_url":"https://api.github.com/users/ajres/repos","events_url":"https://api.github.com/users/ajres/events{/privacy}","received_events_url":"https://api.github.com/users/ajres/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T17:16:38Z","updated_at":"2015-09-16T17:16:38Z","body":"When you say 'custom view' is this added via the views json file, in which case can you post the custom view code and I can test it here.\r\nOr is this a view you have manually modified via the Couchbase Server Admin UI, in which case what is it you want to achieve that can not be achieved via the views json document?\r\n"}}