When I called CouchDB with HTTP POST /{db}/_design/{designDoc}/_view/{view}
I received a document with the field "_conflicts": ["{conflictRev}"]
.
So I used HTTP POST /{db}/_bulk_docs
to delete the conflicted revision with:
"docs": [
{
"_id": "{docId}",
"_rev": "{conflictRev}",
"_deleted": true
}
]
Now when I try to retrieve the document, I get the new field "_deleted_conflicts": [{deletedConflictRev}]
and it's really messing with my backend application implementation, is there a way to completely remove the conflicts info from the document?
I have tried to use HTTP POST /{db}/_purge
with:
"docId": [
"{deletedConflictRev}"
]
But after that the document was gone and I wasn't able to find it neither in couchDB UI, nor with my application, looks like some issue with indexes or something happening in that case.
I use CouchDB 3.2.3
I have managed to resolve this issue by filtering these fields in the map function in the view that is stored in my design doc, both of those I got from the request that was sent by the backend application. Now it looks something similar to this:
function(doc) {
if (!doc._conflicts && !doc._deleted_conflicts) {
emit([doc._id, doc.someField], doc);
}
}
This is an example I've found and not exactly how it looks in my case, but I've based my solution on it and I don't get unwanted fields in my responses anymore.