[SERVER-8832] Prototype extensions get saved along with primitive data Created: 03/Mar/13 Updated: 11/Jul/16 Resolved: 05/Mar/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | 2.4.0-rc1 |
| Fix Version/s: | 2.4.0-rc2 |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Andre Quina | Assignee: | Ben Becker |
| Resolution: | Done | Votes: | 0 |
| Labels: | javascript | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
OSX |
||
| Operating System: | ALL |
| Steps To Reproduce: | db.system.js.save({_id: "extendArray", value: function () { Array.prototype.fancyArrayFunction = function() { return 'do something'; }; }}); ) ; ; ); db.map_reduce_example.find({})[0]['value'] [ Notice that we have 2 elements in the array as we should, but one of the 2 is the function. If I mongoexport the collection I see all three elements, so the console seems to be having an issue with the length of the array on this also. ./mongoexport --jsonArray -d test3 -c map_reduce_example connected to: 127.0.0.1 ] }] |
| Participants: |
| Description |
|
Running the 3/1 nightly build. Builds before that one do not allow calling functions from system.js It appears that functions extending the javascript Array class get added to the array when it gets stored. |
| Comments |
| Comment by auto [ 05/Mar/13 ] | ||||||||||||||||||||||||
|
Author: {u'date': u'2013-03-05T17:11:26Z', u'name': u'Ben Becker', u'email': u'ben.becker@10gen.com'}Message: | ||||||||||||||||||||||||
| Comment by Andre Quina [ 05/Mar/13 ] | ||||||||||||||||||||||||
|
Thanks for the fix. I'll review against our application once it's in the nightly or the next RC. | ||||||||||||||||||||||||
| Comment by Ben Becker [ 05/Mar/13 ] | ||||||||||||||||||||||||
|
Hi Andre, Just wanted to say thank you for the bug report. I went ahead and submitted a fix for review.
Regards, | ||||||||||||||||||||||||
| Comment by Ben Becker [ 05/Mar/13 ] | ||||||||||||||||||||||||
|
The same issue exists for string values, and types.js adds new prototypes. | ||||||||||||||||||||||||
| Comment by Andre Quina [ 03/Mar/13 ] | ||||||||||||||||||||||||
|
This behaves properly in 2.2.0 |