[
https://issues.apache.org/jira/browse/COUCHDB-729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
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: https://issues.apache.org/jira/browse/COUCHDB-729
> 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:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira