How to delete 1 of 2 attachements in Cloudant?

250 Views Asked by At

do you know how to delete 1 of 2 attachements of Cloudant Document?

Here's how my doc looks like enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

Whilst you have two attachments you actually only have one document stored in Cloudant. To delete just the attachment you will need to update the cloudant doc rather than delete it.

You'll need to write some code in your application to remove the attachment from the JSON then send a PUT request to your cloudant db including the ID and the latest _rev value. (API Reference)

Alternatively you could store two documents in your database; one for each attachment. You'd then need to store the user_id and any other metadata in each. This would allow you to delete each document individually.