-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Go Drivers
Detailed steps to reproduce the problem?
- Create a document that both key and value are strings, but the key is "$date".
bson.D{{"$date", "2024-05-20T23:59:59Z"}}
- Marshaling the object to canonical extended JSON succeeds
bson.MarshalExtJSON(doc, true, false)
- Unmarshaling the JSON back to BSON
bson.UnmarshalExtJSON(jsonBytes, true, meta)
It returns an error.
invalid JSON input; expected {
Definition of done: what must be done to consider the task complete?
We expect that marshaling from BSON to canonical extended JSON is reversible through unmarshaling using the go driver. If marshaling succeeds, unmarshaling should produce the original BSON document without an error. Mongodump and mongorestore rely on this assumption to perform database backups correctly.
The exact Go version used, with patch level:
1.21
The exact version of the Go driver used:
v1.11.9
- is depended on by
-
TOOLS-3611 Mongodump and restore should not produce a JSON format error on $-prefixed object keys
- Closed
- related to
-
GODRIVER-2659 bson.UnmarshalExtJSONWithContext does not work for $date
- Closed