Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 48589 invoked from network); 7 Jan 2011 08:58:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jan 2011 08:58:47 -0000 Received: (qmail 25379 invoked by uid 500); 7 Jan 2011 08:58:45 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 24957 invoked by uid 500); 7 Jan 2011 08:58:45 -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 24948 invoked by uid 99); 7 Jan 2011 08:58:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jan 2011 08:58:44 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bitroot@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; Fri, 07 Jan 2011 08:58:38 +0000 Received: by qyk29 with SMTP id 29so18339899qyk.11 for ; Fri, 07 Jan 2011 00:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=JtOkG4BI/MMVuvzqBBRMAYZgvMfFf75iqio2IBXAuQ0=; b=I2A7kUYMzGGu969Pu+Vyknj+H65qhKoXFUiYa/RrLPuLfSrwSgXCIsqn/50iYeMENK zE4HWaGGcbfmOdfrmihMH1jmOZriapep7YIRuP38iGpeSFkN3075Rn8dfTCmlRgra+hE flfUbWz7eKkmp51VM1QQFd2FSDHlMYDxNv1PE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=GL4Luzl89W2KXEhjneqhKFzRqZ8pb6C+UXwBZkQ1KSyh8pIrKvaJd3uVhAp3myTcQC FrMRqdj3+gxJuxC5ydrvWIxpENPvCbXnnk8LvwWU7b+peWikM5UMxSDdL1uNhWchibwY vpHpBdQphclRav0A9Np6xgvRskAZwri66dqhM= MIME-Version: 1.0 Received: by 10.229.184.200 with SMTP id cl8mr11039309qcb.77.1294390697007; Fri, 07 Jan 2011 00:58:17 -0800 (PST) Sender: bitroot@gmail.com Received: by 10.229.222.72 with HTTP; Fri, 7 Jan 2011 00:58:16 -0800 (PST) In-Reply-To: References: Date: Fri, 7 Jan 2011 08:58:16 +0000 X-Google-Sender-Auth: aQg7AhAXjliFshRIt05LhICSgdY Message-ID: Subject: Re: Document versioning with multiple documents From: Joe Freeman 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 I'm still confused about this. Does anyone have any suggestions? Regarding the attachPrevRev approach: I noticed that Chris has posted a comment on his blog[1] that mentions "a mode that loads attachments into the view server". I presume this doesn't exist at the moment, but are there any plans to implement something like this in the future? Thanks. [1] http://jchrisa.net/drl/_design/sofa/_list/post/post-page?startkey=3D%5B= %22Versioning-docs-in-CouchDB%22%5D On 2 January 2011 11:52, Joe Freeman wrote: > I'm trying to implement document versioning using a variation of the > method described under 'Multiple Documents' here: > http://blog.couchone.com/post/632718824/simple-document-versioning-with-c= ouchdb > > (I'd like to have been able to use the 'attachPrevRev' approach, but > unfortunately that doesn't seem to allow me to setup a view that lists > all the revisions for a document - i.e., I can't access the older > revisions (attachments) from the view server.) > > I have documents like this: > > {_id: '1', type: 'page'} > {_id: '2', type: 'page_revision', page: '1', created_at: [2011, 1, 1, > 11, 28, 0], content: 'First revision of first page.'} > {_id: '3', type: 'page'} > {_id: '4', type: 'page_revision', page: '3', created_at: [2011, 1, 1, > 11, 29, 0], content: 'First revision of second page.'} > {_id: '5', type: 'page_revision', page: '3', created_at: [2011, 1, 1, > 11, 30, 0], content: 'Second revision of second page.'} > > My view then has a map function: > > function(doc) { > =A0if (doc.type =3D=3D 'page_revision') { > =A0 =A0emit([doc.page, doc.created_at], doc); > =A0} > } > > Which emits the following keys: > > [1, [2011, 1, 1, 11, 28, 0]] // First revision of first page. > [3, [2011, 1, 1, 11, 29, 0]] // First revision of second page. > [3, [2011, 1, 1, 11, 30, 0]] // Second revision of second page. > > So I add a reduce function to get the latest revision for each page > (and use group_level=3D1): > > function(keys, values) { > =A0return values[values.length - 1]; > } > > When I try to run this, I get a 'reduce_overflow_error' ("Reduce > output must shrink more rapidly"), and I think I understand why. > > However, if I change the reduce function to this: > > function(keys, values) { > =A0return values[values.length - 1]; > /*aaaaaaaaaaaaaaaaaaaaaaa > aaaaaaaaaaaaaaaaaaaaaaaaa > aaaaaaaaaaaaaaaaaaaaaaaaa > aaaaaaaaaaaaaaaaaaaaaaaaa > aaaaaaaaaaaaaaaaaaaaaa*/ > } > > (i.e., pad out the content of the function with a comment) > > Then I don't get the overflow error, and I get the result I was expecting= . > > So this raises two questions: > > 1) Does the fact that I initially get the overflow error suggest that > there's something wrong with my approach? > > 2) Why don't I get the error in the second case? > > And hence, can anyone suggest how I should be solving this problem? > > Thanks :) >