[SERVER-50444] mongo shell serializes large NumberLongs incorrectly Created: 21/Aug/20 Updated: 27/Oct/23 Resolved: 21/Aug/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Arun Banala | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query
|
|||||||
| Operating System: | ALL | |||||||
| Steps To Reproduce: | Steps to reproduce issue #1:
Steps to reproduce issue #2:
|
|||||||
| Participants: |
| Description |
|
I've noticed couple of issues with mongo shell 1. mongo shell is serializing large NumberLong values (which are valid) incorrectly, and send wrong value to the server. Both these issues seem to be because we are converting the number into double first and then interpreting it as 'int64_t' |
| Comments |
| Comment by Arun Banala [ 21/Aug/20 ] | ||||
|
Ah, that makes sense. Thanks for providing the details. I'm going to close this ticket. | ||||
| Comment by Bruce Lucas (Inactive) [ 21/Aug/20 ] | ||||
|
I think this is working as designed - the expression NumberLong(x) means construct a NumberLong object from the value x, and in this case x is a Javascript number, which is implemented by the Javascript interpreter as a double. To construct the NumberLong represented by the string of digits 9223372036854774800 you can pass a string to NumberLong:
|