incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Versioned attachment questions
Date Fri, 01 Jul 2011 22:10:58 GMT
A few questions about how attachments interact with document revisions. Since an attachment
is conceptually [if not actually] embedded in a revision, you can end up with multiple document
revisions that contain attachments with the same name but different contents. That is, attachments
are versioned. Right?

1: I haven’t seen this explicitly stated in the docs, but I assume that you can retrieve
an attachment from an earlier revision of a document by doing:
	GET /db/document_id/attachment_name?rev=revision_id

2: When I GET a document, I just get stubs in the _attachments dictionary. Presumably if I
PUT a new revision of the document, leaving the _attachments dictionary the same, the attachments
will stay the same in the new revision. And if I remove one of the entries from _attachments,
will the corresponding attachment be deleted?

3: Is there any way to tell whether the attachment in one revision is the same as the attachment
in another revision, i.e. whether the attachment changed between the two revisions? Or do
you have to compare lengths and, if they’re the same, GET both revisions in their entirety
and byte-compare them?

View raw message