[GODRIVER-742] Supported parsing extended JSON containing $date without $numberLong Created: 02/Jan/19  Updated: 28/Oct/23  Resolved: 08/Jan/19

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

Type: New Feature Priority: Major - P3
Reporter: David Golub Assignee: David Golub
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

If I attempt to read a MongoDB Extended JSON file containing a date in the format

{ $date: 0 }

instead of

{ $date: { $numberLong: "0" } }

then the parser will fail.



 Comments   
Comment by Githook User [ 07/Jan/19 ]

Author:

{'username': 'skriptble', 'email': 'kris@mongodb.com', 'name': 'Kris Brandow'}

Message: Merge branch 'pr/130'

GODRIVER-742

Change-Id: Id75807e763cc734ee49ddcc5133e76afcfb31223
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/c10d76a5cd577929f9ac4eee7e8b46ef6564bf4a

Comment by Jeffrey Yemin [ 03/Jan/19 ]

After talking with David about this, I'm inclined to accept this request. It's one of those situations where there is data out in the wild that looks like this from older versions of MongoDB, mongoimport still supports it, the Java driver supports it, and since the Go driver is used by various tools at MongoDB it sometimes has to support little-used or deprecated features of MongoDB in order to enable those tools to function properly.

Comment by Jeffrey Yemin [ 02/Jan/19 ]

Yeah, mongoimport/mongoexport doesn't abide by the specification yet. The driver intentionally does not support any legacy JSON formats, so I don't consider this a bug, but I will change the type to feature request for consideration post 1.0. The changes would not be limited to $date most likely, though that's likely the most prevalent.

Comment by Jeffrey Yemin [ 02/Jan/19 ]

I would not expect that to parse. The Go driver supports the Extended JSON specification, and that format is not specified. See https://github.com/mongodb/specifications/blob/master/source/extended-json.rst#id21.

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