On Fri, Jul 1, 2011 at 15:10, Jens Alfke <[email protected]> wrote: > 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
I think so. > > 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? Again, I believe this is the case. > > 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? > > —Jens The stubs in the _attachments object each have a "revpos" property that should correspond to the first part of the _rev where they were last modified. Does that help? Anyway, from IRC: <davisp> Jens has questions on the ML that seem like things we should have in the test suite So I'm starring these and I'll look into these when I have more time. If you get to it before I do please file anything you think is an issue (or file as an improvement) on JIRA. Thanks!
