Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 92847 invoked from network); 7 Feb 2011 23:35:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Feb 2011 23:35:43 -0000 Received: (qmail 95994 invoked by uid 500); 7 Feb 2011 23:35:42 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 95956 invoked by uid 500); 7 Feb 2011 23:35:41 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 95948 invoked by uid 99); 7 Feb 2011 23:35:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 23:35:41 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [212.227.17.8] (HELO moutng.kundenserver.de) (212.227.17.8) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 23:35:32 +0000 Received: from [192.168.0.53] (host86-167-243-151.range86-167.btcentralplus.com [86.167.243.151]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0Lj72Q-1QPVvy01Ik-00dPO7; Tue, 08 Feb 2011 00:35:12 +0100 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1082) Subject: Re: Atomic update of multiple attachments? From: Robert Johnson In-Reply-To: <4D507F64.7030405@databill.com> Date: Mon, 7 Feb 2011 23:34:40 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <4D507F64.7030405@databill.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1082) X-Provags-ID: V02:K0:l+/HhuJliOse9mRTYVJWByWNvnGG8VRhaXwoj/0qGQu b+2qRzbrg6tHSpCbdzmWJb6hIIcWVHKiiCD/mK5RhWM9aC7i4J Un3JrcTnx2lqD1AZiX1pzNjcYFKNA86CINzlUeZb/zDYD822yy ziguiM+TNnDqbGd1FGsEJqlLoIB3ordZk7pwP6eBs7gwYfQbfx Ikt6ZLQdU5hrolplaGLQIhhViy5nvqTGeRVGDzvK38= X-Virus-Checked: Checked by ClamAV on apache.org 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"=20 Create a view which only emits when "attachment_count_so_far" =3D = "eventual_attachment _count" 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: >=20 > For create: > 1. Create a document. > 2. Add attachments to it. > 3. Only now does the document and all of its attachments become = visible. >=20 > 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. >=20 > 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.