incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: View with datetime values
Date Fri, 03 Apr 2009 14:02:04 GMT
emit works by just storing the key/value pairs in an array and then
when all views in the same _design document have been calculated
returns all results at once. As you've noticed this can lead to the
pass by reference confusion.

Feel free to add a note to the wiki.

Paul Davis

On Fri, Apr 3, 2009 at 7:46 AM, Tim Somers <> wrote:
> Hi guys,
> Okay, I found what's going on. Calling the "emit" function passes the
> object's reference, so if I alter the object afterwards, the emited value
> gets altered with it. I fixed it by changing
> emit([doc.monitorID, doc.LocDateTime], subDateTime);
> to
> emit([doc.monitorID, doc.LocDateTime], eval(uneval(subDateTime)));
> which seems to work.
> This does leave me with a question: is this intended behavior? If so, maybe
> it should at least be mentioned in the docs?
> Thanks
> Tim

View raw message