[SERVER-11867] In strict-json mode, represent NumberLongs with strings Created: 26/Nov/13 Updated: 16/Jun/14 Resolved: 02/Dec/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.5 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Eric Milkie | Assignee: | Shaun Verch |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Description |
|
Rather than represent numberlongs in strict json as a number, it should be represented as:
|
| Comments |
| Comment by Bernie Hackett [ 11/Jun/14 ] | ||||||
|
I don't think we can have the drivers encode native long types to $numberLong subdocuments in JSON instead of numbers. That's likely to break existing applications that use JSON, and $numberLong isn't supported by earlier server versions, tools, third party drivers, earlier versions of our drivers, etc. We can easily decode from $numberLong to something appropriate for a given language, but it may be a lossy conversion. For example, in python 2 we would decode this to long, regardless of value. But in python 3 there is only an int type. We will lose the context that {$numberLong: "256"} should be encoded from python int(256) to BSON int64 instead of BSON int32. | ||||||
| Comment by Scott Hernandez (Inactive) [ 05/Dec/13 ] | ||||||
|
Drivers: If you parse/output json then you should adopt the new format. Docs: We need to add this to the release notes, extended json doc, and update tool examples (like mongoexport/bsondump). mongoexport example:
bsondump example:
Note: some of these changes came through with | ||||||
| Comment by Githook User [ 04/Dec/13 ] | ||||||
|
Author: {u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}Message: | ||||||
| Comment by Githook User [ 02/Dec/13 ] | ||||||
|
Author: {u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}Message: |