Purging documents via Sync Gateway endpoint is not removing the documents from Couchbase Server

Hello,

I am trying to purge the documents from a bucket using the Sync Gateway API, the endpoint response is a success, however, I am still seeing the documents in the bucket.

Sync Gateway configuration used for the bucket is shown in the screenshot attached.

Any idea why the documents are not getting purged?

The response shows which document IDs were purged based on the request - in your case it is showing that no purges happened.

Have you checked the document ID being passed in the request matches the one in the bucket? This will be case sensitive.

@bbrks

I am using the documentId as shown in the screenshot.

The document exists in the bucket and after executing the Sync Gateway purge endpoint, the document still exists.

Please can you let me know how to make this work.

Does any configuration need to be set on the bucket for the purge to work?

Also, does the ‘*’ in the payload means all the documents will be purged upon successful completion of the endpoint

{
  "a_doc_id": [
    "*"
  ]
}

Thanks
JS

Your purge request format should be:

{
  "Previoussales_0009128d-999f-4866-99a0-b52df4717ee8Q": ["*"],
  "another_doc_id_here_if_you_want_to_purge_more_than_one": ["*"]
}

The star represents which revisions to remove (in this case, all revisions of the given document ID)

@bbrks

Thanks, it is working after changing the request payload as mentioned by you.

Is there a way to purge all the documents and all its revision in a bucket?
or
Do we need to provide individual documentIds in the request payload?

Thanks

You have to specify document IDs if purging through Sync Gateway.

You could investigate purging via Couchbase Server instead, if you’d like to completely empty your database.