-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Go Drivers
-
None
-
None
-
None
-
None
-
None
-
None
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
-
- is related to
-
GODRIVER-3531 Some decimal128 values can be marshaled to JSON, but can't be unmarshaled
-
- Closed
-
- related to
-
GODRIVER-2659 bson.UnmarshalExtJSONWithContext does not work for $date
-
- Closed
-