Deleting document attachments in CouchDb

Posted by henrik_lundgren on Stack Overflow See other posts from Stack Overflow or by henrik_lundgren
Published on 2010-05-01T14:07:25Z Indexed on 2010/05/01 15:27 UTC
Read the original article Hit count: 158

Filed under:

In CouchDb's documentation, the described method of deleting document attachments is to send a DELETE call to the attachment's url.

However, I have noticed that if you edit the document and remove the attachment stub from the _attachment field, it will not be accessible anymore.

If i remove foo.txt from the document below and save to CouchDb it will be gone the next time I access the document:

{  
  "_id":"attachment_doc",  
  "_rev":1589456116,  
  "_attachments":  
  {  
    "foo.txt": 
    {  
        "stub":true,  
        "content_type":"text/plain",  
        "length":29  
    }  
  }  
}

Is the attachment actually deleted on disk or is just the reference to it deleted?

© Stack Overflow or respective owner

Related posts about couchdb