couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Koberg <...@koberg.com>
Subject Re: drill into a doc with a GET?
Date Thu, 08 Jan 2009 03:54:00 GMT

On Jan 7, 2009, at 10:32 PM, Paul Davis wrote:
>
>
> Remember that views are (theoretically) calculated once per doc. So
> the lookups would be extremely fast once the view is built.
>
> I haven't a good way to explain this yet, but remember that a clever
> view strategy can answer multiple query types. Try not to think of a
> view as a single select statement.  I really hate comparing things
> back to SQL, but you should think of a view as being able to answer a
> class of selects that have different values in a where clause.

given the following doc:

{"_id": "a", "_rev": "123", "foo": {"bar": {"baz": 1}}}

and

http://127.0.0.1:5984/db_name/_view/view_name/by_property? 
key=["foo.bar", "a"]

to get  {"baz": 1}

I would need to send a key like 'foo.bar' - is that acceptable as a  
key value. I mean if the key is used in JS like somedoc[propVar], it  
won't work. But perhaps this is done in a different layer (or eval'd  
in some way?) and the dot syntax will just work?

I was hoping for a way to drill into a hierarchy of a known document  
and grab what I want however deep it might be from a GET (next, I will  
ask for PUT and DELETE :) ).

thanks for sticking with me,
-Rob

>
>
> HTH,
> Paul

Mime
View raw message