javascript - Updating doc in Pouch DB -
i have db in pouchdb, , need able update documents. when click "update" in table data fields form, want change data in form , press "save updated" button , have fields updated. here's i've tried:
function saveupdated(){ var vaucherid = window.document.vaucherform.vaucherid.value; var date = window.document.vaucherform.date.value; var invoicenumber = window.document.vaucherform.invoicenumber.value; var vendorid = window.document.vaucherform.vendorid.value; var amount = window.document.vaucherform.amount.value; var fund = window.document.vaucherform.fund.value; var deptid = window.document.vaucherform.deptid.value; var descript = window.document.vaucherform.descript.value; //i idvalue when have values db form db.get('idvalue').then(function(doc) { return db.put({ _id: 'idvalue', _rev: doc._rev, vaucherid: vaucherid, date: date, invoicenumber: invoicenumber, vendorid: vendorid, amount: amount, fund: fund, deptid: deptid, descript: descript }); }).then(function(response) { // handle response }).catch(function (err) { console.log(err); }); }
so error
o {status: 404, name: "not_found", message: "missing", error: true, reason: "missing"}
hm, maybe it's because doc._rev
undefined/null, treated differently not including _rev
field @ all? have live example reproduce?
Comments
Post a Comment