Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 26066 invoked from network); 8 Jan 2009 03:00:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Jan 2009 03:00:12 -0000 Received: (qmail 18281 invoked by uid 500); 8 Jan 2009 03:00:10 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 18216 invoked by uid 500); 8 Jan 2009 03:00:10 -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 18205 invoked by uid 99); 8 Jan 2009 03:00:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2009 19:00:10 -0800 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [69.20.54.33] (HELO server2.livestoryboard.com) (69.20.54.33) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jan 2009 03:00:01 +0000 Received: from [192.168.2.5] (c-76-24-63-132.hsd1.nh.comcast.net [76.24.63.132]) by server2.livestoryboard.com (Postfix) with ESMTP id 27C162BEA0A for ; Wed, 7 Jan 2009 21:59:41 -0500 (EST) Message-Id: <5F4CD013-AB8B-4570-8106-6DCE08FBA550@koberg.com> From: Robert Koberg 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: drill into a doc with a GET? Date: Wed, 7 Jan 2009 21:59:40 -0500 References: <013C8232-C1A7-4C69-8996-21C86B41B340@koberg.com> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org On Jan 7, 2009, at 9:24 PM, Paul Davis wrote: > Robert, > > The function you're describing doesn't exist, but the end result does. > This would be done using a view to get only parts of a document that > are interesting to the calling code. Its not automatic by any means, > but you could write a view that would give you something similar: > > function(doc) > { > for(var field in doc) > { > emit([field, doc._id], doc[field]); > } > } > > Then to access a specific property: > > http://127.0.0.1:5984/db_name/_view/view_name/by_property? > key=["foo", "docid1"] OK, that is what I thought. Seems extremely inefficient (but what do I know :) ) since I know the exact document and path to the property. It seems like I would need to create unknown numbers of views to handle these types of lookups while going through all docs in a DB each time. thanks, -Rob > > > HTH, > Paul Davis > > On Wed, Jan 7, 2009 at 4:18 PM, Robert Koberg wrote: >> Hi, >> >> first, couchdb is just beautiful! :) (using 0.8.1-incubating from >> MacPorts) >> >> I am very new, and have read the available docs and several blog >> posts. >> >> Can you drill into a doc with a simple GET? >> >> Say I have a doc like: >> >> {"_id": "a", "_rev": "123", "foo":{"bar": 1}, "big-ass-prop": "huge >> amount >> of stuff"} >> >> Ideally I would like to be able to call something like: >> >> http://127.0.0.1:5984/mydb/a/foo >> >> to return {"bar":1} and avoid downloading "big-ass-prop" >> >> Is this or something like it possible? >> >> (I realize "foo" is a 'sibling' of the _id in the document, but it is >> probably treated more like a parent in the DB?) >> >> If not possible, is it possible to create some kind of default >> action/filter/? that does something like the above? That is, reads >> the >> request uri, recognizes it is a document and that there is extra >> path info >> which should be used to resolve a property. >> >> thanks, >> -Rob >>