Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 32695 invoked from network); 14 Nov 2010 23:14:46 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Nov 2010 23:14:46 -0000 Received: (qmail 51079 invoked by uid 500); 14 Nov 2010 23:15:11 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 51020 invoked by uid 500); 14 Nov 2010 23:15: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 51012 invoked by uid 99); 14 Nov 2010 23:15:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Nov 2010 23:15:11 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of robert.newson@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Nov 2010 23:15:04 +0000 Received: by qyk36 with SMTP id 36so2773926qyk.11 for ; Sun, 14 Nov 2010 15:14:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=Z+Je5+pA3ybL8IJeUcfbekPWYPMU9cA9r4puW9hSKyM=; b=cJi9d7Z5FkBysRt1hx17TxyP7aR6fLEf50rg6dY7CRl5tw1De7xcdZQ2bypA/pW6Bd g3nVKAApncubDA+b7ENyckmFYILedoc68mykpj4rR7O6EW2TCU8jndx537BeUe5rfg/j TxoCRtPLbp9iWcMam66+i1X3uroiUQk7KeWmw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=CLJHEimF/9tWrlOgi/ueT9y5PpvLpDNPpYhmJSKq64P4NuC8XE5LBeiGOpCM/h3Vv9 d90qad9W6iOjHNG4MHv9upult0RVHRNmAIem47AmvIEeyVGzH3HI69gLYGUVawpWMyYy A7yrYqVnTvjEnyG00pg5sJM3a5u9QOWldMPrM= MIME-Version: 1.0 Received: by 10.229.81.12 with SMTP id v12mr4556005qck.12.1289776482832; Sun, 14 Nov 2010 15:14:42 -0800 (PST) Received: by 10.229.100.65 with HTTP; Sun, 14 Nov 2010 15:14:42 -0800 (PST) In-Reply-To: References: Date: Sun, 14 Nov 2010 23:14:42 +0000 Message-ID: Subject: Re: Banking Recipe From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org "If you really need transactions in the classical, RDBMS sense, where you need to update a bunch of related records in one atomic operation, then CouchDB is not for you." I think that's a little overstated. Instead, realize that updates to a document are atomic, and therefore you should model your transactions as documents. B. On Sun, Nov 14, 2010 at 10:53 PM, Luciano Ramalho wro= te: > On Sun, Nov 14, 2010 at 5:39 AM, Andy wrote: >> >> Im well versed in Java/Hibernate/RDBMS. =A0Im trying to get my head arou= nd how NoSQL does not use transactions. >> I read the Banking Recipe which didn't really do the job: http://guide.c= ouchdb.org/draft/recipes.html >> So if I wanted to write an online banking app, I would have say a millio= n Transaction Documents, and to find a persons balance I would need to sum = all transactions? =A0There must be a better way. > > Hi, Andy. > > If you really need transactions in the classical, RDBMS sense, where > you need to update a bunch of related records in one atomic operation, > then CouchDB is not for you. > > If you are an expert backhoe operator, and your main job is digging > trenches, don't switch to a forklift or you will be disappointed. > > CouchDB is document database. It shines and makes you life as > programmer much easier if your application has a document centered > model. Here is an example. > > I've been involved in project to create a repository for clinical > trial records (CTR). A CTR is a large record, with several embedded > sub-records, such as researcher data, sponsor data, patient > recruitment parameters and so on. In our cases, many of the fields are > multilingual, for example, procedure descriptions must be given in > English and the language(s) of the country(ies) where the clinical > trial is recruiting. Once published, a CTR must never be changed or > deleted. If updated, the previous version must be kept intact and a > permanent link to it is embedded in the new version. > > This is a mess to implement securely using a relational database. One > conceptual record becomes dozens of records spread over dozens of > tables. Normalization helps with "update anomalies" but in this case > we don't want a related record to be updated behind our backs, losing > track of the previous state of the CTR. In many cases here, updating > *is* the anomaly, so we don't want it to be easy or fast, we need to > control every bit of information in the CTR as one whole. > > A document oriented database is perfect for a job like this, because I > can structure and manage the whole CTR as one document. Keeping past > versions frozen is a snap. CouchDB is just the right tool for a job > like this. > > A forklift sucks at digging, but if you need to move crates around, > nothing beats it. > > -- > Luciano Ramalho > programador repentista || stand-up programmer > Twitter: @luciano >