Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB13ED271 for ; Thu, 12 Jul 2012 14:42:14 +0000 (UTC) Received: (qmail 47343 invoked by uid 500); 12 Jul 2012 14:42:13 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 46949 invoked by uid 500); 12 Jul 2012 14:42:11 -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 46834 invoked by uid 99); 12 Jul 2012 14:42:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2012 14:42:07 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dave@muse.net.nz designates 209.85.213.52 as permitted sender) Received: from [209.85.213.52] (HELO mail-yw0-f52.google.com) (209.85.213.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2012 14:42:00 +0000 Received: by yhpp61 with SMTP id p61so2814866yhp.11 for ; Thu, 12 Jul 2012 07:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=muse.net.nz; s=google; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=mfcUXafZdq3s0ic5sqCV2w3aWTgzhDUuxWeBJel9okY=; b=aqk0kEoEj9nub4dY9qPbsugJ23aH+0MyB4+migcwAOxOlVRymiFOKNuKMn/tGqj85l Quy0FVG9xYN+JsRdSBjLWAVJ6yoSoGJ+f12iaFE5ZHPRyCgmDfiicGS15MdVCOMwfsxO ncrOzl4elBD3iYWfNe33S+Zi+hJ2NiMdlxalw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=mfcUXafZdq3s0ic5sqCV2w3aWTgzhDUuxWeBJel9okY=; b=EMH8YXwcOGKgYVfntnrp36ztm82Bsyj3CWVlXnn2T9wHeayXCnzq5MfgwCSJpoyUYg 1fPXokohgJsRFQvzzf8YmOwlpHwpMmfLKE1YlYHmgu1SxFVRGX5Op/RI83jVIxYSVxKM 6KyqdUcplEM0XjuRGGCSxGU+kT3rgzW3GXnmZVzCTzkGQU8RPGLeTErVBgnvRCIzaXVw jxvDxb1VmradWnpGf2iEGwk1rpr2FV5rkiauLuavQUzzzS0hu72zuv7custhJHEG2Nge DqBoWTNkXWh6PqLYI5t0tcFHDAKtxY8p4092jTOF87Eo/FF6GzYvpVDcuGh2wIukkwld XDIQ== MIME-Version: 1.0 Received: by 10.68.217.234 with SMTP id pb10mr6080864pbc.79.1342104099519; Thu, 12 Jul 2012 07:41:39 -0700 (PDT) Received: by 10.68.52.137 with HTTP; Thu, 12 Jul 2012 07:41:39 -0700 (PDT) X-Originating-IP: [84.112.19.176] In-Reply-To: References: Date: Thu, 12 Jul 2012 16:41:39 +0200 Message-ID: Subject: Re: Data modelling From: Dave Cottlehuber To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQk/xH8TRx7PC2YTCNUxERcTdt08xul2YNbhFVGEzoGq3gRlBRNeSvPazOofba9REteQTriS On 12 July 2012 15:47, Matthieu Rakotojaona wrote: > Just a precision : > > On Thu, Jul 12, 2012 at 1:07 PM, Bernhard Gschwantner > wrote: >> With that construction, you can be sure that it will never happen that you >> deduct an amount from one account and never add it to the other. If you >> make this two transaction documents, It could be that you try to create >> both documents, but only one succeeds. Or if you replicate your database, >> the first one is replicated, and then the network connection goes down. > > You can use the _bulk_docs endpoint with the all_or_nothing option, to > use some kind of transaction : > http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API#Transactional_Semantics_with_Bulk_Updates > > I know that replication uses the bulk API for putting the docs on the > target, but I don't know if it includes this option. > > -- > Matthieu RAKOTOJAONA Matthieu, Yes this is possible on a single instance but you can't guarantee anything greater than a single document transaction as soon as you subsequently use _changes, replication or views on top of that DB. A+ Dave