[JAVA-734] JSON.parse() should handle $timestamp correctly Created: 15/Jan/13  Updated: 19/Mar/13  Resolved: 29/Jan/13

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.10.1
Fix Version/s: 2.11.0

Type: Improvement Priority: Major - P3
Reporter: Sjoerd Mulder Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When trying to parse a JSON string containing Mongo Extended JSON like: http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON
The JSON.parse utility function doesn't know about this type. Underlying problem is in the JSONCallback.java file which has a if else for a lot of extensions but not the $timestamp.
example:
JSON.parse(("{ \"$timestamp\" :

{ \"$t\": 123, \"$i\": 456 }

}"))



 Comments   
Comment by auto [ 23/Jan/13 ]

Author:

{u'date': u'2013-01-23T14:45:55Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: Merge pull request #100 from sjoerdmulder/timestamp_fix

JAVA-734 JSON.parse doesn't handle $timestamp correctly
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/b5b686b93b9749b1e3f3121cb37ce08d71544671

Comment by auto [ 23/Jan/13 ]

Author:

{u'date': u'2013-01-23T13:30:36Z', u'email': u'sjoerd@frontendless.nl', u'name': u'Sjoerd Mulder'}

Message: JAVA-734 JSON.parse doesn't handle $timestamp correctly
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/5839dc7172e300db74d3438531b20f06d298b910

Comment by Sjoerd Mulder [ 15/Jan/13 ]

Actually it should be $timestamp:

{ t: 123, i: 456 }

. Documentation is correct, looking at the code https://github.com/mongodb/mongo/blob/master/src/mongo/db/jsobj.cpp.

Updating pull-request

Comment by Sjoerd Mulder [ 15/Jan/13 ]

Pull request: https://github.com/mongodb/mongo-java-driver/pull/98

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