1

Can anyone explain to me why I'm getting this response trying to delete a document?

curl -X DELETE --header 'Accept: application/json' 'http://localhost:4985/mydb/uprofile:testing'

When I run this, I get:

{
    "error": "conflict",
    "reason": "Document exists"
}

How come?

Sthe
  • 2,575
  • 2
  • 31
  • 48

1 Answers1

0

A conflict usually occurs when two writers are offline and save a different revision of the same document.

As quick fix first get document from syn-gateway and

curl -X GET --header 'Accept: application/json' 'https://localhost:4985/uprofile%3Atesting/mydb?attachments=false&revs=false&show_exp=false'

Then get _rev value from document.. Then try delete as following

curl -X DELETE --header 'Accept: application/json' 'https://localhost:4985/uprofile%3Atesting/mydb?rev={_rev value}'

I am sure this will work, but for permanent solution where to resolve conflicts dynamically check documentation https://developer.couchbase.com/documentation/mobile/current/guides/sync-gateway/resolving-conflicts/index.html

BEJGAM SHIVA PRASAD
  • 2,181
  • 1
  • 18
  • 27