Error occurred while writing a data into CouchDB

593 Views Asked by At

I am trying to Delete the whole data from the CouchDB and again i am trying to write same data with modified **_id field and some extra field **

but i am getting following error :

{ 'reason' => 'Document update conflict.', 'error' => 'conflict', 'id' => 'test_1' }, { 'reason' => 'Document update conflict.', 'error' => 'conflict', 'id' => 'test_2' },

How to resolve the error ?

1

There are 1 best solutions below

1
On

When creating new document "test_1", there should be a document with that name already having a different _rev in your db. If you need to update the old "test_1", you need to provide the _rev of that document when updating. Or else, you can delete "test_1" and then try creating another document with the name "test_1". The point here is, you should provide the latest _rev of a certain document, when updating that document.