[JAVA-488] Support serialization to Mongo extended JSON format Created: 13/Dec/11 Updated: 18/Jun/12 Resolved: 20/Apr/12 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.8.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Antoine Girbal | Assignee: | Bryan Reinero |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Provide full support for serialization to http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON. This can be useful for REST interfaces or other tools that use the java driver. So as not to break existing applications that rely on the current behavior, the output of the com.mongodb.util.JSON.serialize method will not be changed. Instead, use the following:
|
| Comments |
| Comment by Jeffrey Yemin [ 18/Jun/12 ] |
|
Closing for 2.8.0 release. |
| Comment by auto [ 04/Jun/12 ] |
|
Author: {u'login': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by auto [ 04/Jun/12 ] |
|
Author: {u'login': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by Jeffrey Yemin [ 20/Apr/12 ] |
|
There will be a legacy serializer which works as the current driver does, so as not to break existing applications that rely on the current behavior. As Bryan says, the strict serializer will work as per the spec. |
| Comment by Antoine Girbal [ 20/Apr/12 ] |
|
note that the java serialization may not respect part of the spec.. |
| Comment by Scott Hernandez (Inactive) [ 20/Apr/12 ] |
|
Yep, here is the actual commit: https://github.com/mongodb/mongo-java-driver/commit/5db92cb8bd04858eb36d9b81510f40b9188c3bb2 That was more for Antoine as a reference; sorry if that wasn't clear. |
| Comment by Jeffrey Yemin [ 20/Apr/12 ] |
|
It does. |
| Comment by Scott Hernandez (Inactive) [ 20/Apr/12 ] |
|
The implementation should follow this format, which is our standard: http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON |
| Comment by Antoine Girbal [ 20/Apr/12 ] |
|
what was the implementation like? Something like {a: {$bin: "base64str", $type: N}} |
| Comment by Bryan Reinero [ 20/Apr/12 ] |
|
github commit 5db92cb8bd04858eb36d9b81510f40b9188c3bb2 |
| Comment by Jeffrey Yemin [ 11/Mar/12 ] |
|
This shouldn't be the default, since it changes current behavior, and is also not possible to distinguish the base 64 from other text. How about a method like JSON.serialize(Object o, JSON.Options options) where the Options class allows control over binary data presentation. I don't see an obvious way to allow round-tripping with JSON.parse(String s) |