[SERVER-5379] js increment operators (ob.prop += ob2.prop) do not work, after assigment like this ob = ob2 Created: 23/Mar/12 Updated: 08/Mar/13 Resolved: 07/Mar/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | 2.0.3, 2.1.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Azat Khuzhin | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
I think in all environment, but my is "Linux azat 2.6.38custom1.0 #1 SMP Mon May 23 17:17:08 MSD 2011 x86_64 GNU/Linux" |
||
| Issue Links: |
|
||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
| Comments |
| Comment by Ben Becker [ 07/Mar/13 ] | ||||||||||||||||||||||||||||||||||||||||
|
The arguments passed to the reduce function are now mutable, as of
| ||||||||||||||||||||||||||||||||||||||||
| Comment by Ian Beaver [ 12/Jan/13 ] | ||||||||||||||||||||||||||||||||||||||||
|
I have a bunch of M/R code written against 2.2 using spidermonkey, and this issue totally bit me when I moved to 2.3.1 with v8. This needs to be documented and at the very least throw an exception so people are aware of the change. It took me a while to figure out why I was getting empty results in the new environment with identical data. | ||||||||||||||||||||||||||||||||||||||||
| Comment by Azat Khuzhin [ 03/May/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
But also, why it is marked as read-only? | ||||||||||||||||||||||||||||||||||||||||
| Comment by Azat Khuzhin [ 03/May/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
It is true, I have messages in log | ||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 30/Apr/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
the problem in the 2nd example is that the values passed to reduce() are optimized by being marked read-only. It is true that it can be deceiving that it is just a log line, we should probably throw an exception when trying to write instead of failing silently. | ||||||||||||||||||||||||||||||||||||||||
| Comment by Azat Khuzhin [ 27/Mar/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
BTW the output is:
"reduce: 1" | ||||||||||||||||||||||||||||||||||||||||
| Comment by Azat Khuzhin [ 27/Mar/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
The second example, must have 1 at all steps ( reduce() must be called once ), in collection just two rows with "count: 1" I can`t reopen issues | ||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 23/Mar/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
please reopen if you think there is still a bug. | ||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 23/Mar/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
Note that in your 2nd example, it is probably a different issue.
It is not sure that vals[i].foo will always be 1. | ||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 23/Mar/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
the example works as expected.
| ||||||||||||||||||||||||||||||||||||||||
| Comment by Azat Khuzhin [ 23/Mar/12 ] | ||||||||||||||||||||||||||||||||||||||||
|
Code that above, is must work so, but this one, doesn`t
|