From user-return-3832-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Mar 04 18:21:55 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 5985 invoked from network); 4 Mar 2009 18:21:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Mar 2009 18:21:54 -0000 Received: (qmail 43874 invoked by uid 500); 4 Mar 2009 18:21:52 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 43722 invoked by uid 500); 4 Mar 2009 18:21:51 -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 Delivered-To: moderator for user@couchdb.apache.org Received: (qmail 19376 invoked by uid 99); 4 Mar 2009 18:11:06 -0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tkruthoff@gmail.com designates 209.85.198.231 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=9NPZd4+9081df2v4dRKUmDjaoV4u451PiKBti8a16no=; b=N9Km2yOVmxIfxFL6blMkAcwGq4MmI95yu3H8sEysHl3nt06Ufo/3iYy0tYjzTANvJv 7TX4DgUx5QD+KkpyPxAuRQCz8pWLupxOXhN7d/4tAuXuJc17kqwKQ+tGavZ1ZTbVph+7 csJ9iTvwKKkRqJ2LQ16r6nUlISB4GMijf67Oo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=aCcPXC/qs9qJYktmVGW8VEuuMVpnnj1fAo9QXaKOR50B3IPYpCvCgAuHtmBFctOfsQ weSYEZBrK2i25iKo5CAUf17WtsReojG+IRPA1xT/bQk3UNvliasCuu4iAXk2xZpypj+V D/MAR1v+ni85PFIbq+UQM91kZ9IEIxHr4zfKg= Message-Id: From: Troy Kruthoff To: user@couchdb.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: Suggestions required on app design Date: Wed, 4 Mar 2009 10:10:37 -0800 References: X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org On Mar 4, 2009, at 9:34 AM, Ramkrishna Kulkarni wrote: > Hello All, > > Please bear with me, I'm new. I have been playing with CouchDB > recently and I find it kool! I would appreciate if someone from the > list could answer few of my questions below. > > Consider I have a database-per-user design and I want to be RESTful. > > a) How do I list all users by just typing a URL like http://server/users/? There is a built-in view http://host:5984/_all_dbs > > b) Is there a way to specify startkey and endkey while listing such > databases? For example: I want to list only databases of users > starting with "a" I believe the _all_dbs view can be filtered just like any other view (see query options http://wiki.apache.org/couchdb/HTTP_view_API) > > > I know this is possible if there is sinlge "users" database with a > document for each user with _id=user-id. > > Further, consider I have database-per-blog as well (assume this is a > simple blog application). > a) How do I create something like view (views I believe cannot be run > across databases) so that whenever a user resource is requested, I > return all blogs written by that user in addition to user information? > Basically links to all blog resources. > > Probably this logic should be in the application. Fire two queries, > one to get user data and another to get blogs? Your on the right track. In the users database you can store the name of the blog databases. > > > The reason I'm trying to do this is because I'm bit scared about > having data in just couple of huge files. I would rather have data > spread out in several smaller files. > > Probably there are better ways to do this. Please let me know. > > Thanks, > Ram