Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 58426 invoked from network); 29 Feb 2008 08:58:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Feb 2008 08:58:43 -0000 Received: (qmail 63563 invoked by uid 500); 29 Feb 2008 08:58:39 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 63539 invoked by uid 500); 29 Feb 2008 08:58:38 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 63530 invoked by uid 99); 29 Feb 2008 08:58:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 00:58:38 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of janlehnardt@googlemail.com designates 66.249.82.225 as permitted sender) Received: from [66.249.82.225] (HELO wx-out-0506.google.com) (66.249.82.225) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 08:58:02 +0000 Received: by wx-out-0506.google.com with SMTP id h30so4754040wxd.21 for ; Fri, 29 Feb 2008 00:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:from; bh=zAR9mTBD0kB9c9diZByAtRTVGcor6oRUPrfQWWkZWOI=; b=r2vVtFt0oOt3h78LwpUkN1VFZM4gGPJFXIBBO9idZzoIsgbXVWTnQppT3ZBwh29HkVwRKczgekXVsnbJKWWxK/ZhRaUJ24NTrBZRBhdUu9jd6McGNn1VYdMwl9vTvYROSlDIRBNXaS0evcsvPt5zy2Nme1403HKJGOae905r3JM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:from; b=R14C4vyuYAHFz9n1AIKKhKcVIL6LbGPKAm6gO2ItErLC7qu3hd1b8QQyOGUd4foXUQInqlgB2ULrrRExHjyqF69srWlEsLwrZifRxcMnJNSo79+UFZS+XNZjYkB40VM0lCV61Q3/ZaZOC7kVCgLU6bb354CyrB77zffynTVyz0A= Received: by 10.100.143.12 with SMTP id q12mr18633969and.89.1204275491100; Fri, 29 Feb 2008 00:58:11 -0800 (PST) Received: from ?192.168.1.33? ( [85.179.68.65]) by mx.google.com with ESMTPS id h17sm1726327wxd.24.2008.02.29.00.58.08 (version=SSLv3 cipher=OTHER); Fri, 29 Feb 2008 00:58:10 -0800 (PST) Message-Id: <2B616801-78B4-4E0C-A007-ED07F77F646C@gmail.com> To: couchdb-user@incubator.apache.org In-Reply-To: <94307D08-00C4-4C65-B68C-8976038398A7@sankatygroup.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: nested docs / comments view Date: Fri, 29 Feb 2008 09:58:05 +0100 References: <94307D08-00C4-4C65-B68C-8976038398A7@sankatygroup.com> X-Mailer: Apple Mail (2.919.2) From: Jan Lehnardt X-Virus-Checked: Checked by ClamAV on apache.org Hi, On Feb 29, 2008, at 05:40, Brad Anderson wrote: > > It just doesn't feel right to have the parents keep track of its > children's ids, for chance of orphaning, maint. nightmares, and > more. Who knows, maybe it's a better approach. Even if I take that > route, when iterating thru the children of a doc, how do I > recursively call the function? Can there be subfuns in Javascript > (well, CouchDB views)? For the threaded discussion demo I did, I saved all the parent document ids in the child document. If you create a view indexed on the parent list (and a timestamp) you get a nice threaded threaded list of documents. Finally with a bit of startkey= and enkey= trickery, you can limit it down to "one parent and all its children". This is obviously not very friendly towards changes to the tree structure where you move nodes and/or subtrees, but that is still possible. Cheers Jan --