incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Relational-esque behavior in CouchDB
Date Mon, 01 Mar 2010 15:53:15 GMT
Mike,

It'd be quite difficult if not impossible to be able to build the
derivative view incrementally. Allowing map functions to pull data
from a random location would break the referential transparency
requirement.

HTH,
Paul Davis

On Mon, Mar 1, 2010 at 10:41 AM, Mike Keen <mk@visiture.com> wrote:
> Hey,
>
> I am managing a database that has hundreds of thousands of documents (so far), all containing
a field called "keyword_id". I am not storing the "keyword_name" inside of each individual
document for several reasons. The biggest reason being that the name could change at any time,
but I don't want old documents to become outdated. I still want them to be associated with
one another.
>
> Anyway, I am wondering if there is currently a special function within the CouchDB JavaScript
view server to pull data across views. I have a view that serves as an index of keyword_ids/names.
I also have another view that aggregates keyword data, but can't return the keyword names.
Currently, I just run two requests to CouchDB. One to retrieve all aggregated keyword data,
and another to retrieve the relevant keyword names as they relate to the ids.
>
> I am assuming that the way I am doing it is currently the best way, but wanted to see
if it was possible to run something like:
>
> function(doc) {
>  var keyword_name = view("/lu_persistence/_design/keywords/_view/keyword_id_name_map?key="
+ doc.keyword_id);
>  doc.keyword_name = keyword_name;
>  emit(null, doc);
> }
>
> Maybe I'm just nuts, but I think this would be ridiculously useful. And if it's already
in there, and someone could point me in the right direction, I'd greatly appreciate it.
>
> Thanks a million,
> Mike Keen
>

Mime
View raw message