couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: API within view code
Date Fri, 01 Aug 2008 17:50:12 GMT
On Fri, Aug 1, 2008 at 10:17 AM, Demetrius Nunes
<> wrote:
> Also, can I share some state between "map" calls or pass external parameters
> to it besides the default "doc" parameter?

You have to be very careful with things like this - shared state is a
definite no-no, as you must ensure the map functions output the same
thing regardless of the order in which documents are processed.

I include utility functions in a separate file automatically when I
push views to CouchDB. My design documents turn out longer in Futon
than in my editor, with lots of code duplicated across the views, but
it doesn't really impact performance, as the functions are compiled
only once per document batch.

Chris Anderson

View raw message