"bulk_docs" REST API to delete a doc revision does not act on the request

Hello,

We use “bulk_docs” Admin REST api to delete losing revisions when resolving conflicts. It works in some instances. But in some instances the deleted document revision remains even though the REST call succeeds. Are there conditions under which bulk_docs call ignores delete requests?

This an example:

Initial return of REST “_changes” call:
{
“seq”:52752,
“id”:“container_3bb400684b124e23ae0530f5259f87c1”,
“changes”:[
{
“rev”:“5-f1aed7234c57d8d5b6d69234478bccb9”
},
{
“rev”:“5-cbc693f41ad889a4a6ef5295cb90c441”
}
]
}

Now, call “bulk_docs” REST call with this json to delete one of the revisions. The call returns with success status:

{
“new_edits”: true,
“docs”: [
{
“_id”: “container_3bb400684b124e23ae0530f5259f87c1”,
“_rev”: “5-cbc693f41ad889a4a6ef5295cb90c441”,
“_deleted”: true
}
]
}

Then a call to “_changes” REST api after the delete still shows both revisions:
{
“seq”:52752,
“id”:“container_3bb400684b124e23ae0530f5259f87c1”,
“changes”:[
{
“rev”:“5-f1aed7234c57d8d5b6d69234478bccb9”
},
{
“rev”:“5-cbc693f41ad889a4a6ef5295cb90c441”
}
]
}

We since notice that the _bulk_docs POST response contains an error in the form:

[
{
“error”: “500”,
“id”: “container_3bb400684b124e23ae0530f5259f87c1”,
“reason”: “Exception in JS sync function”,
“status”: 500
}
]

Can someone help understand what this error relates to?

Thanks.

As pointed out in the reason field above, there is an exception in the Sync Gateway’s sync function - so suggest looking there.