couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <kocol...@apache.org>
Subject Re: altering 'doc' variable in map function affects other map functions
Date Mon, 25 Oct 2010 00:52:16 GMT
On Oct 24, 2010, at 4:42 PM, afters wrote:

> Hello couchers,
> 
> I have the following two map functions (v1.0.1):
> 
> function (doc) {
>   emit(doc.path[0], null);
> }
> 
> function (doc) {
>  doc.path = [ 'an intruder from another view' ];
> }
> 
> When the views are built, the first map function sees a 'doc' variable that
> was changed by the second map function! and thus emits the key 'an intruder
> from another view'.
> 
> The real documents remain untouched.
> 
> Besides being a great way for map functions to communicate with each other,
> I assume it's also a bug?
> 
> 
> a.

Well, yes.  At one point map functions in a single view group were supposed to be protected
from one another, but that's been broken for a long time, and I'm not sure about an ETA for
restoring it.

Adam


Mime
View raw message