Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 47326 invoked from network); 19 Apr 2009 18:03:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Apr 2009 18:03:33 -0000 Received: (qmail 6532 invoked by uid 500); 19 Apr 2009 18:03:32 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 6451 invoked by uid 500); 19 Apr 2009 18:03:32 -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 6441 invoked by uid 99); 19 Apr 2009 18:03:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2009 18:03:32 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of th.heller@gmail.com designates 209.85.221.112 as permitted sender) Received: from [209.85.221.112] (HELO mail-qy0-f112.google.com) (209.85.221.112) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2009 18:03:25 +0000 Received: by qyk10 with SMTP id 10so3121691qyk.13 for ; Sun, 19 Apr 2009 11:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=azHz0BpOOgFnxFMA8wGPw9qcmZZoKYi6QqvJ3+IIiAU=; b=A4JMu7vDs36pY4MHasHo5W+gnDT2N0XOo7ThqjtB1Zlyf4IWYKaNORZ3TQKKgG1i4T 3aIUS7WjIq4W0jI1zMKPcyCTErbxKnUXnXJtMPk+UFyh4Y0ThQ+KxYi+sMhzZf3R0jQt R5NYGgkwDzSsgEkbsqhF1LaYPo4fhWSqLyHkk= 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; b=LknhNbVGN29mlRX2hgJ8ZgCt1h+dhBke73fYq9J+XDL45HUBASjmvSW/2lRVf5zXCO oHmyih5OPhqsXPKXZinGiRpHC3e+BjlKM6zkNqdSoXtoNrm9YIQuVPRiTcUvuQ/NFucb JINBZqLIkZThqSXp2Poa16zhaS+yHE418TJ1g= MIME-Version: 1.0 Received: by 10.220.44.204 with SMTP id b12mr4827192vcf.42.1240164182956; Sun, 19 Apr 2009 11:03:02 -0700 (PDT) In-Reply-To: <000B5B36-2484-484B-9CBE-3D649A1339B8@gmail.com> References: <9acd6e550904190118i56c4ac65y46972998dc58e46a@mail.gmail.com> <000B5B36-2484-484B-9CBE-3D649A1339B8@gmail.com> Date: Sun, 19 Apr 2009 20:03:02 +0200 Message-ID: <9acd6e550904191103r12527b1na0a9e8941df757aa@mail.gmail.com> Subject: Re: Mapping a Relation and include_docs From: Thomas Heller To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016e647ee2a96a1970467ec39c1 X-Virus-Checked: Checked by ClamAV on apache.org --0016e647ee2a96a1970467ec39c1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit > > Hmmm... I don't know how CouchDB gets those source document IDs. I suppose > it would be nice to be able to say include_docs=field:userid so CouchDB > would return the document with the ID equal to the value of the userid > field. > > I'm interested in what the devs think of this... Devs? pretty sure that this would require to parse/serialize the associated doc to do the lookup (which would be slow/expensive), my "idea" would just store another id along the already existing id. So in my head the doc lookup code would look like doc:get(map_result.replace_id || map_result.id). I have no idea what I'm talking about tho. ;) > > > The only Problem I have with my implementation is that a user is never >> allowed to edit his own membership, only a group admin is allowed to do >> that. So I have 2 different people editing the same Document and somehow >> that feels dirty. >> > > But wouldn't a validation function be able to test for exactly these > situations? If the change is proposed by a user then these fields are > allowed to change, if a group admin then these fields... > > I suppose programming is a bit different from just saying "you have > read-only access to this column" so I can understand your hesitation. > Triple-check your validation functions I would say :) > Its not about validation its about handling the data. Currently I just hand the complete user document over to the client and let him do whatever. He sends it back and all I have to do is a simple post. Now when I cannot trust him (he may fake himself into some super secret groups or somesuch) I have to take the memberships array out of his data, fetch the right one from the database, sync them and post it back. Plenty of places where stuff can go wrong. Also my Idea is a pure optimization as the problem is already solved by doing two simple get requests and I have no idea if it would be any improvent on the server side. Maybe some couchdb guru can tell me that I'm overthinking this stuff and I'll stick to my all-in-one doc or seperate doc approached, whenever I can decide which one I like more ;) Cheers, /thomas --0016e647ee2a96a1970467ec39c1--