{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3578","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3578/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3578/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3578/events","html_url":"https://github.com/pouchdb/pouchdb/issues/3578","id":59234997,"number":3578,"title":"Filtered replication ignores _deleted docs","user":{"login":"sphaso","id":4958220,"avatar_url":"https://avatars.githubusercontent.com/u/4958220?v=3","gravatar_id":"","url":"https://api.github.com/users/sphaso","html_url":"https://github.com/sphaso","followers_url":"https://api.github.com/users/sphaso/followers","following_url":"https://api.github.com/users/sphaso/following{/other_user}","gists_url":"https://api.github.com/users/sphaso/gists{/gist_id}","starred_url":"https://api.github.com/users/sphaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphaso/subscriptions","organizations_url":"https://api.github.com/users/sphaso/orgs","repos_url":"https://api.github.com/users/sphaso/repos","events_url":"https://api.github.com/users/sphaso/events{/privacy}","received_events_url":"https://api.github.com/users/sphaso/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pouchdb/pouchdb/labels/first%20timers%20only","name":"first timers only","color":"02e10c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":38,"created_at":"2015-02-27T13:18:58Z","updated_at":"2015-12-02T09:25:19Z","closed_at":"2015-04-03T11:42:27Z","body":"Hi.            \r\nI'm facing a weird issue using PouchDB 3.3.0. Basically when I set filtered replication using a ddoc the onChange doesn't immediately trigger at load time (but it does without filters!). I have to ctrl+R and then I finally see something.\r\n\r\nThis is my setup (with the filter parameters commented). I'm not sure if this is a bug or just dumbness on my part. I've seen a PR vaguely related to filtered replication so I thought I'd ask.\r\n\r\n```javascript\r\nlocalDB.sync(remoteDB, {\r\n                        live: true,\r\n                        retry: true\r\n                })\r\n            .changes({\r\n            continuous: true,\r\n            //filter: 'app/by_user',\r\n            //query_params: { agente: agent },\r\n            onChange: function(change){\r\n                $rootScope.$apply(function(){\r\n                    localDB.get(change.id, function(err, doc){\r\n                        console.log(\"change detected!\");\r\n                        if(!change.deleted){\r\n                            $rootScope.$apply(function(){\r\n                                if(err) console.log(err);\r\n                                else {\r\n                                    console.log(\"broadcast\");\r\n                                    $rootScope.$broadcast('upsert', doc);\r\n                                }\r\n                            });\r\n                        }\r\n                        else if(change.deleted){\r\n                            $rootScope.$apply(function(){\r\n                                $rootScope.$broadcast('delete', {_id: change.id});\r\n                            });\r\n                        }\r\n                    });\r\n                });\r\n            }\r\n        });\r\n```"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/161232879","html_url":"https://github.com/pouchdb/pouchdb/issues/3578#issuecomment-161232879","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3578","id":161232879,"user":{"login":"raymatos","id":832789,"avatar_url":"https://avatars.githubusercontent.com/u/832789?v=3","gravatar_id":"","url":"https://api.github.com/users/raymatos","html_url":"https://github.com/raymatos","followers_url":"https://api.github.com/users/raymatos/followers","following_url":"https://api.github.com/users/raymatos/following{/other_user}","gists_url":"https://api.github.com/users/raymatos/gists{/gist_id}","starred_url":"https://api.github.com/users/raymatos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raymatos/subscriptions","organizations_url":"https://api.github.com/users/raymatos/orgs","repos_url":"https://api.github.com/users/raymatos/repos","events_url":"https://api.github.com/users/raymatos/events{/privacy}","received_events_url":"https://api.github.com/users/raymatos/received_events","type":"User","site_admin":false},"created_at":"2015-12-02T09:25:19Z","updated_at":"2015-12-02T09:25:19Z","body":"I'm deleting the doc via the db.remove(doc) call.\n\n\n\n\nDesign docs live on both local and remote.  I'm deleting from the local.\n\n\n\n—\nSent from Mailbox\n\nOn Wed, Dec 2, 2015 at 3:13 AM, sphaso <notifications@github.com> wrote:\n\n> Just so we're on the same page: \n> - are you deleting the docs by updating the \"_deleted\" field?\n> - are your design docs both on the client and the server?\n> There are a few caveats I described at the end of [this post](http://pouchdb.com/2015/04/05/filtered-replication.html) but I haven't upgraded to v5 since writing it.\n> ---\n> Reply to this email directly or view it on GitHub:\n> https://github.com/pouchdb/pouchdb/issues/3578#issuecomment-161215423"}}