couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afters <afters.m...@gmail.com>
Subject altering 'doc' variable in map function affects other map functions
Date Sun, 24 Oct 2010 20:42:24 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message