[SERVER-520] CodeWScope not working in reduce function for M/R Created: 04/Jan/10 Updated: 12/Jul/16 Resolved: 08/Oct/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | 1.7.2 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Hubert Lepicki | Assignee: | Tony Hannan |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ruby 1.8 / Ruby 1.9 |
||
| Participants: |
| Description |
|
With $where you can do something like: posts.find($where => Code.new("i < 3", {i: 2})) and there will be scope created with i variable set to 2 fror "i < 3" part. However, this doesn't work with map-reduce functions. map = "function() { emit(this._id, {foo: 'bar'); }" ", {x: 1}) This throws an error like: |
| Comments |
| Comment by Tony Hannan [ 08/Oct/10 ] |
|
Map/reduce/finalize function scopes now get added to the general mapReduce scope. |
| Comment by auto [ 08/Oct/10 ] |
|
Author: {'login': 'TonyGen', 'name': 'Tony Hannan', 'email': 'tony@10gen.com'}Message: |
| Comment by Eliot Horowitz (Inactive) [ 05/Jan/10 ] |
|
in the meantime you can use the "scope" attribute" on the map/reduce command |
| Comment by Michael Dirolf [ 04/Jan/10 ] |
|
Just assigning this to eliot as I assume it's not high priority enough to need a fix before you're back. Not sure if you want to fix yourself or assign to mathias. |