{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5154","repository_url":"https://api.github.com/repos/pouchdb/pouchdb","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5154/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5154/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5154/events","html_url":"https://github.com/pouchdb/pouchdb/issues/5154","id":154315697,"number":5154,"title":"Deprecate db.put(doc, id, rev)","user":{"login":"fade2g","id":7560623,"avatar_url":"https://avatars.githubusercontent.com/u/7560623?v=3","gravatar_id":"","url":"https://api.github.com/users/fade2g","html_url":"https://github.com/fade2g","followers_url":"https://api.github.com/users/fade2g/followers","following_url":"https://api.github.com/users/fade2g/following{/other_user}","gists_url":"https://api.github.com/users/fade2g/gists{/gist_id}","starred_url":"https://api.github.com/users/fade2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fade2g/subscriptions","organizations_url":"https://api.github.com/users/fade2g/orgs","repos_url":"https://api.github.com/users/fade2g/repos","events_url":"https://api.github.com/users/fade2g/events{/privacy}","received_events_url":"https://api.github.com/users/fade2g/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pouchdb/pouchdb/labels/enhancement","name":"enhancement","color":"02d7e1"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-05-11T18:52:39Z","updated_at":"2016-06-18T21:43:20Z","closed_at":"2016-06-18T21:43:20Z","body":"My way of updating a document is like this:\r\n\r\nMake a get, then put the new document with the _rev value from the document from get call. If the get call returns no document, make a put without _rev (obvisouly).\r\n\r\n```javascript\r\n function addDoc() {\r\n      db.get(designDoc._id)\r\n        .then(function(originalDoc) {\r\n          return db.put(designDoc, designDoc._id, originalDoc._rev);\r\n        })\r\n        .catch(function(err) {\r\n          if (err.status === 404) {\r\n            return db.put(designDoc);\r\n          } else {\r\n            console.log('Error while updating design document:' + err);\r\n          }\r\n        });\r\n    }\r\n```\r\nWhen executing this, I get the error message \"invalid rev format\". Experimenting, I realised, that I should not supply a value for ID, i.e. `return db.put(designDoc, undefined, originalDoc._rev);`.\r\n\r\nI think that the error message is quite misleading and should be changed to indicate, that supplying an _id in the document AND in the put call is wrong. Possibliy, updating the documentation at https://pouchdb.com/api.html#create_document with hints on not using both values would be good as well.\r\n\r\nSee my plnkr http://plnkr.co/edit/QSpI1X?p=preview "},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/226966609","html_url":"https://github.com/pouchdb/pouchdb/issues/5154#issuecomment-226966609","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5154","id":226966609,"user":{"login":"daleharvey","id":37787,"avatar_url":"https://avatars.githubusercontent.com/u/37787?v=3","gravatar_id":"","url":"https://api.github.com/users/daleharvey","html_url":"https://github.com/daleharvey","followers_url":"https://api.github.com/users/daleharvey/followers","following_url":"https://api.github.com/users/daleharvey/following{/other_user}","gists_url":"https://api.github.com/users/daleharvey/gists{/gist_id}","starred_url":"https://api.github.com/users/daleharvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daleharvey/subscriptions","organizations_url":"https://api.github.com/users/daleharvey/orgs","repos_url":"https://api.github.com/users/daleharvey/repos","events_url":"https://api.github.com/users/daleharvey/events{/privacy}","received_events_url":"https://api.github.com/users/daleharvey/received_events","type":"User","site_admin":false},"created_at":"2016-06-18T21:43:20Z","updated_at":"2016-06-18T21:43:20Z","body":"Fixed in https://github.com/pouchdb/pouchdb/commit/d38f8690ece454809530d9fe0480e5a343336c6b"}}
{"actor":{"display_login":"daleharvey"}}