Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 56806 invoked from network); 1 Apr 2010 13:43:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Apr 2010 13:43:14 -0000 Received: (qmail 79887 invoked by uid 500); 1 Apr 2010 13:43:13 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 79832 invoked by uid 500); 1 Apr 2010 13:43:13 -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 79823 invoked by uid 99); 1 Apr 2010 13:43:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Apr 2010 13:43:13 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [80.244.253.218] (HELO mail.traeumt.net) (80.244.253.218) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Apr 2010 13:43:04 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.traeumt.net (Postfix) with ESMTP id 01AFE1B572 for ; Thu, 1 Apr 2010 15:42:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.g3th.net Received: from unknown by localhost (amavisd-new, unix socket) id LaSmbyYakVxi for ; Thu, 1 Apr 2010 15:42:41 +0200 (CEST) Received: from [10.0.1.21] (g230187063.adsl.alicedsl.de [92.230.187.63]) (authenticated) by mail.traeumt.net (amavisd-milter) (authenticated as web50m1); Thu, 1 Apr 2010 15:42:41 +0200 (CEST) (envelope-from ) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1078) Subject: Re: Using _rev in application logic From: Jan Lehnardt In-Reply-To: Date: Thu, 1 Apr 2010 15:42:40 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <5131FB47-D76E-4708-92D3-2415715856CF@apache.org> References: To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1078) X-Virus-Checked: Checked by ClamAV on apache.org Hi Moritz, On 1 Apr 2010, at 14:32, Moritz Post wrote: > Hi CouchDB people >=20 > I am currently playing with the couchdb and pretty impressed by = several of > the feature on offer. Great job so far. While reading up on various = web > resources i have come to conclude that it is discouraged to use the = _rev > field for application related logic since the revisions are removed = when > compacting and they are not replicated when using replication. >=20 > Looking at my possible usecase however, i would very much like to use = the > _rev key to track changes in my document. So here are several = questions > regarding that topic: >=20 > 1. Is it generally discouraged to use the _rev in application logic? Yes, you should not rely on old revisions to be around in your app. Your app will fail in unexpected ways and perceive data-loss if you rely on revisions being around forever. > 2. Is compacting something i would like to do for other reasons than = to > remove older revisions (so i could basically not do it) CouchDB's b-tree store is sparse, unless you make very few very large = bulk doc inserts, you will waste a lot of space. Not running compaction is = considered "doing it wrong". > 2. Is it possible to somehow also replicate the revision while = replicating? This is another reason for not using revisions in applications. > 3. Is it good practice to use the _rev field in views? Views can only always see the latest revision of a document. You can't = even access previous revisions. > Any other clarifications in regards to _rev are also welcome. We encourage this workflow: 1. Load a document, 2. make a copy, 3. change the document to reflect your changes, 4. attach the copy to the new changed document, 5. save back to CouchDB. > Thanks in advance and keep up the good work Welcome and thanks, keep the questions coming :) Cheers Jan --