You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I didn't see an area where suggestions could be contributed (is there such a place) so I am putting this here. I don't know if there is a formal API to which pouch is being developed and, if there is and the following change is not compatible, then feel free to close this.
I noticed in the query logic, there is a function method called "emit" that the querying code is supposed to call in order to add the document under consideration to the view. There is some additional code with the following comment
// ugly way to make sure references to 'emit' in map/reduce bind to the
// above emit
It seems a more elegant way to accomplish this same thing is to actually pass the "emit" function as an argument to the map/reduce function - in effect, a callback to the callback. That way, there is no risk that the map/reduce function inadvertently gets bound to to the wrong emit method. It also removes the "ugly" binding hack.
The text was updated successfully, but these errors were encountered:
The current code for map reduce functionality is only in there for compatibility with CouchDB map reduce views, and changing the syntax of the map reduce functions would break that compatibility
The mapreduce code is fairly well uncoupled from the rest of the database code and the plan is to have various query plugins that may have nicer syntax etc, but the mapreduce one has to be kept as is for compatibility
I didn't see an area where suggestions could be contributed (is there such a place) so I am putting this here. I don't know if there is a formal API to which pouch is being developed and, if there is and the following change is not compatible, then feel free to close this.
I noticed in the query logic, there is a function method called "emit" that the querying code is supposed to call in order to add the document under consideration to the view. There is some additional code with the following comment
// ugly way to make sure references to 'emit' in map/reduce bind to the
// above emit
It seems a more elegant way to accomplish this same thing is to actually pass the "emit" function as an argument to the map/reduce function - in effect, a callback to the callback. That way, there is no risk that the map/reduce function inadvertently gets bound to to the wrong emit method. It also removes the "ugly" binding hack.
The text was updated successfully, but these errors were encountered: