incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Van Pelt" <vanp...@gmail.com>
Subject Re: drill into a doc with a GET?
Date Thu, 08 Jan 2009 02:24:45 GMT
Robert,

If you want to return only a portion of your document, you would need
to create a view:

http://wiki.apache.org/couchdb/HTTP_view_API

If you wanted to pull back only specific documents that had a "bar"
value of 1, you should add the value of "bar" to your key during the
map process.

If you want to have fancy urls that meet your needs, you would need to
create a proxy between the client and couch.  The proxy would most
likely be a seperate web server that either used a library to speak
with couch, such as CouchREST:
http://github.com/jchris/couchrest/tree/master.  Or simply re-wrote
your URL's to adhear to the couch REST API.

Cheers,

Chris

On Wed, Jan 7, 2009 at 6:18 PM, Robert Koberg <rob@koberg.com> 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
>

Mime
View raw message