[SERVER-1075] $inc/$dec update operation changes datatypes (int/long -> float) Created: 02/May/10 Updated: 28/May/10 Resolved: 02/May/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Scott Hernandez (Inactive) | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
This is untested but is expected as the stored int/long value will be coerced to a float, as the value coming from javascript is a float. This will effect M/R as well as the shell. |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 02/May/10 ] |
|
Yes, but when I talked to Mike he thought maybe a server-side fix could be implemented. So if you inc/dec by 1.0 (=1L) it would not change the stored type, just the value. This would work for conversions between any of the numeric datatypes, if no accuracy was lost (whole numbers). This could also be applied when setting a value in an update where the type was already numeric as well. I guess that would make this a feature (to make the the javascript shell work seamlessly) . Requiring the use of 2.toInt()/toLong() or some kind of javascript Long/Int object would make this terribly verbose and cumbersome, no? |
| Comment by Eliot Horowitz (Inactive) [ 02/May/10 ] |
|
if you mean from javascript, then this is expected and the correct behavior if i'm misunderstanding, please attach an example |