There's also the multipart/related upload api (though undocumented, I think). you can send a doc and 0, 1, or many attachments in a single PUT call. On Mon, Feb 7, 2011 at 11:38 PM, Robert Johnson wrote: > > Create your document with attributes "eventual_attachment _count" (set this to the expected count) and "attachment_count_so_far" (set this to zero). > As you add each attachment, increment "attachment_count_so_far" > > Create a view which only emits when "attachment_count_so_far" = "eventual_attachment _count" > > > For update:- > > Remove docs and decrement "attachment_count_so_far" > Reset "eventual_attachment _count"if necessary > Add new attachments and increment "attachment_count_so_far" > > Does this work for you? > > Bob > > On 7 Feb 2011, at 23:25, Wayne Conrad wrote: > >> Is there anything I can do to achieve the illusion of atomic update of a set of attachments?  Here's the effect I'd like: >> >> For create: >> 1. Create a document. >> 2. Add attachments to it. >> 3. Only now does the document and all of its attachments become visible. >> >> For update: >> 1. Delete all of the document's attachments. >> 2. Add a new set of attachments to the document. >> 3. Only now does the new set of attachments appear to replace the old. >> >> I'm using Couchdb 1.0.2 and CouchRest 1.0.1.  I'm not opposed to cheating to achieve my goal.  Suggestions of "Did you think of doing this-other-thing instead?" are also welcome. > >