couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Lehnardt (Closed) (JIRA)" <>
Subject [jira] [Closed] (COUCHDB-729) View Generation: emit() not instantaneous
Date Sun, 30 Oct 2011 21:12:32 GMT


Jan Lehnardt closed COUCHDB-729.

    Resolution: Won't Fix

emit() will append to a buffer inside the query server, tmp will point to the same object.
I don't think making a deep copy is a good idea. This is a leaky abstraction we are unlikely
to close (unless somebody has a fabulous patch that does not introduce any performance or
memory issues.
> View Generation: emit() not instantaneous
> -----------------------------------------
>                 Key: COUCHDB-729
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>         Environment: Using Win7
>            Reporter: Walt W
>   Original Estimate: 2h
>  Remaining Estimate: 2h
> Try the following view function:
> function(doc) {
>   var tmp = { result: 'a' };
>   emit(null, tmp);
>   tmp.result = 'b';
>   emit(null, tmp);
> }
> The unfortunate happening is that (null, { result: 'b' }) is emitted twice per document,
rather than one 'a' and one 'b'.  I would think that the emit function should grab and copy
the values passed immediately; it does not make sense or seem useful (to me anyway) to allow
them to change after the fact.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message