[GODRIVER-2659] bson.UnmarshalExtJSONWithContext does not work for $date Created: 18/Nov/22 Updated: 27/Oct/23 Resolved: 30/Nov/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Robin Tang | Assignee: | Kevin Albertson |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
| Comments |
| Comment by Kevin Albertson [ 30/Nov/22 ] | ||||||||||||||
|
Hello rtang.cs@gmail.com, thank you for reaching out.
No, not fully. Supporting the legacy format for $date was added in
Unmarshalling is expected to return a primitive.DateTime. primitive.DateTime has a Time() helper. Here is an example:
Closing since this does not suggest a bug in the driver. The Jira project is for reporting bugs and feature requests. For other types of help, please post in the community forum here. | ||||||||||||||
| Comment by Robin Tang [ 18/Nov/22 ] | ||||||||||||||
|
Eventually, I was able to get this solved by setting `canonical` to be `False` and using `UnmarshalExtJson(..)`
However, I stumbled upon this:
The existing Go library does not return `date` back in `time.Time` format, instead...it's giving it back in `ms` as well.
| ||||||||||||||
| Comment by Robin Tang [ 18/Nov/22 ] | ||||||||||||||
|
It might be because I am using extended JSON v1, see: https://www.mongodb.com/docs/manual/reference/mongodb-extended-json-v1/#date
If so, does this SDK support v1? |