var couchdb = require("couchdb-api");
var server = couchdb.srv(localhost, 5984, false, false);
var db = server.db("test");
var doc = db.doc("d5e1d042d579fcb1b3d4df07bc001f74");
doc.del(function (err, response) {
console.log(response);
console.log(err);
});
after that i am facing the problem,
null
{ error: 'bad_request', reason: 'Invalid rev format' }
but the corresponding document having the proper revision like 1-135dc47e3492a980fa45b3af9eb22a97 and proper data.
Please provide me the solution.
Thanks in advance.
I’m the creator of this module. The issue here is that you are attempting to delete the document without a revision number. (there is a
_revnumber on your document, butcouchdb-apidoes not have that information) Any other attempt to write would also trigger this error under these conditions.You have a couple options as it stands now:
Get the current document before attempting to write/delete
Explicitly set your revision number before attempting the write/delete
I’m going to add a better error message here, and I’m considering adding a special flag that will tell
couchdb-apito “force” a delete even if it doesn’t have the latest revision number. (ie. it will callgetbeforedelin order to avoid MVCC)