{"action":"closed","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4374","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4374/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4374/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4374/events","html_url":"https://github.com/pouchdb/pouchdb/issues/4374","id":108778127,"number":4374,"title":"Deletes not syncing from pouchdb to couchdb when using a design document","user":{"login":"npow","id":206201,"avatar_url":"https://avatars.githubusercontent.com/u/206201?v=3","gravatar_id":"","url":"https://api.github.com/users/npow","html_url":"https://github.com/npow","followers_url":"https://api.github.com/users/npow/followers","following_url":"https://api.github.com/users/npow/following{/other_user}","gists_url":"https://api.github.com/users/npow/gists{/gist_id}","starred_url":"https://api.github.com/users/npow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npow/subscriptions","organizations_url":"https://api.github.com/users/npow/orgs","repos_url":"https://api.github.com/users/npow/repos","events_url":"https://api.github.com/users/npow/events{/privacy}","received_events_url":"https://api.github.com/users/npow/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-29T01:34:34Z","updated_at":"2015-09-29T04:42:00Z","closed_at":"2015-09-29T04:42:00Z","body":"When deleting an item from pouchdb, the deletion is not syncing to couchdb when using a design document with `query_params`. Deletions sync fine when removing the item from couchdb. Furthermore, it also works without using a design document filter.\r\n\r\nCode to reproduce is below. Run `main.js`, then run `insert.js`, then go to `http://localhost:9999/delete/1`. I expect the change to be replicated on couchdb. If you go to `http://localhost:9999` it shows all the local items.\r\n\r\nmain.js:\r\n```\r\nvar PouchDB = require(\"pouchdb\");\r\nPouchDB.plugin(require('pouchdb-authentication'));\r\n\r\nvar remoteDb = new PouchDB('http://localhost:5984/testdb');\r\nvar localDb = new PouchDB('testdb');\r\n\r\nvar express = require('express');\r\nvar app = express();\r\n\r\nlocalDb.sync(remoteDb, {\r\n  live: true,\r\n  retry: true,\r\n  filter: 'myfilter',\r\n  query_params: { email: 'a@a' }\r\n}).on('change', function (info) {\r\n  console.log('change: ', info.change.docs);\r\n}).on('paused', function () {\r\n  console.log('paused');\r\n}).on('active', function () {\r\n  console.log('active');\r\n}).on('denied', function (info) {\r\n  console.log('denied');\r\n}).on('complete', function (info) {\r\n  console.log('done: ', info);\r\n}).on('error', function (err) {\r\n  console.log('error: ', err);\r\n});\r\n\r\napp.get('/', function (req, res) {\r\n  localDb.allDocs().then(function (docs) {\r\n    res.send(docs);\r\n  });\r\n});\r\n\r\napp.get('/sync', function (req, res) {\r\n  res.send('Hello World!');\r\n});\r\n\r\napp.get('/delete/:id', function (req, res) {\r\n  console.log('id: ', req.params.id);\r\n  localDb.get(req.params.id).then(function (doc) {\r\n    console.log('deleting: ', doc);\r\n    doc[\"_deleted\"] = true;\r\n    console.log('doc: ', doc);\r\n    localDb.remove(doc._id, doc._rev).then(function (err) {\r\n      console.log('err: ', err);\r\n      res.send(err);\r\n    }).catch(function (err) {\r\n      console.log('err: ', err);\r\n    });\r\n  });\r\n});\r\n\r\nvar server = app.listen(9999, function () {\r\n  var host = server.address().address;\r\n  var port = server.address().port;\r\n\r\n  console.log('Example app listening at http://%s:%s', host, port);\r\n});\r\n```\r\n\r\ninsert.js:\r\n```\r\nvar PouchDB = require(\"pouchdb\");\r\nvar Promise = require('bluebird');\r\n\r\nvar remoteDb = new PouchDB('http://localhost:5984/testdb');\r\n\r\nvar id = 0;\r\nPromise.all(['a@a', 'b@b'].map(function (email) {\r\n  return Promise.all([1,2,3,4,5].map(function (x) {\r\n    return remoteDb.put({ _id: (++id).toString(), email: email, name: 'hi'+x, description: 'desc' });\r\n  }));\r\n    })).then(function (res) {\r\n      console.log('done');\r\n    });\r\n\r\nremoteDb.put({\r\n  _id: '_design/myfilter',\r\n  filters: {\r\n    myfilter: function (doc, req) {\r\n      return doc.email === req.query.email;\r\n    }.toString()\r\n  }\r\n}).then(function (err, res) {\r\n  console.log(err, res);\r\n});\r\n```\r\n"}}