[GODRIVER-1517] Extended JSON $date incorrectly parses integer literals Created: 03/Mar/20  Updated: 27/Oct/23  Resolved: 18/Mar/20

Status: Closed
Project: Go Driver
Component/s: JSON & ExtJSON
Affects Version/s: 1.3.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: David Golden Assignee: Divjot Arora (Inactive)
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The $date format requires a string or a $numberLong, but the driver incorrectly parses integer literals like the following:

{"":{"$date":1}}
0f0000000900010000000000000000
 
{"":{"$date":-1}}
0f0000000900ffffffffffffffff00

N.B. floats do error:

{"":{"$date":1.23}}
unmarshal error: $date value should be string or object, but instead is double



 Comments   
Comment by David Golden [ 18/Mar/20 ]

I'm fine closing won't fix, as I now understand this is legacy Java driver behavior.

Comment by Divjot Arora (Inactive) [ 17/Mar/20 ]

david.golden Is this due to the changes made in GODRIVER-742? If so, one option would be to update the error message to include the fact that the value can be an integer, but we can't make it error.

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