[DRIVERS-342] add Json result : Simple type mode Created: 05/Dec/16  Updated: 15/Apr/19  Resolved: 04/Dec/17

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: guillaume dufour Assignee: Bernie Hackett
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates DRIVERS-351 Implement Extended JSON Spec Implementing
Related

 Description   

Hello,

i try to respond to the jira JAVA-1280 in my PR 346 (https://github.com/mongodb/mongo-java-driver/pull/346) because i experiment some bugs when i try to parse my json from Document.toJson() with a jackson project (emfjson-jackson and emfjson-mongo).

Hope it can help other people ;o)

As @rozza said:
However, if you feel strongly that the MongoDB Drivers really should support this feature, then I urge you to file a ticket to the DRIVERS project. If you explain the rational for new feature and the conversions to and from Bson types, then as a drivers team we can best look at the feature.

So here is the issue after 9 months on wait without any response....



 Comments   
Comment by Bernie Hackett [ 04/Dec/17 ]

I'm closing this as a duplicate of DRIVERS-351, which requires the relaxed mode.

Comment by Jeffrey Yemin [ 04/Dec/17 ]

Relaxed extended JSON solves the specific issue of serializing BSON Int64 values as JSON numbers instead of using $numberLong. JAVA-1772 allows for full customization of JSON serialization so that a wide variety of effects can be achieved.

Comment by Bernie Hackett [ 04/Dec/17 ]

With the introduction of the MongoDB Extended JSON spec, is this ticket resolved? ross.lawley jeff.yemin, does the Java driver implementation of the spec resolve JAVA-1280?

Comment by Ralph Jennings [ 04/Apr/17 ]

Ideally, we wouldn't need to convert anything to JSON ourselves and could just use jackson in the library to get a MongoCollection<MyJacksonSerializableObject> (whereas right now we are forced to get a MongoCollection<Document> and turn the document into jackson-compatible – non mongo-extended – JSON text and use a jackson ObjectMapper to turn that back into a MyJacksonSerializableObject, unless we want to write yet another set of parser/conversion classes for mongo).

Comment by guillaume dufour [ 05/Dec/16 ]

The problem is emfjson is base on jackson.
Json product by mongo java driver contains 2 problem for me:

  • Date : wich is not understand as i rember by jackson
  • huge number wich is parsed by jsckson but complicated to parse because we send data and one time we have a number, one time we have an object....

I don't test a lot for Date because I don't have the problem. (No date in my data)
But I have problem on long as you can see here:
https://github.com/emfjson/emfjson-mongo/blob/master/src/test/java/org/emfjson/mongo/tests/MongoHandlerSaveAndLoadTest.java#L62

Comment by Ross Lawley [ 05/Dec/16 ]

Hi dufgui,

Thanks for adding this ticket, once again I'd like to apologise for the lack of response on your PR, behind the scenes we have been looking at extended json but unfortunately, I neglected to update the issue and let you know.

Currently, converting a document to extended json does produce valid Json and allows for all Bson types to be round tripped without losing the type information. I'd like your help in understanding more about the issues or pain it is that causing you when using the extended json?

From the tests in the PR it seems to only be numerics and dates that are handled differently. Is that for better interoperability with other Json libraries? Does it matter that the fidelity could be lost when round tripping the numeric data types?

Thanks,

Ross

Comment by guillaume dufour [ 05/Dec/16 ]

Sorry it's a feature not a bug

Generated at Thu Feb 08 08:21:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.