-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Go Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Canonical encoding for UUIDs uses hex, like d0af18c6-23a9-4aeb-9523-89fba73d31f0. The Go driver, though, marshals UUIDs to extJSON as $binary/base64. This makes it hard for humans who read the extJSON to correlate those UUIDs with other contexts that likely encode the UUIDs in the more typical hex format.
Extended JSON allows UUIDs to be encoded as $uuid, which confers two benefits over $binary:
- Legibility, as discussed above.
- Concision: $uuid doesn't have to encode a binary subtype, so the resulting eJSON string is smaller.
Per a recent Slack thread, it seems that the driver specification mandates $binary as default behavior. Still, it would be beneficial to have $uuid output, at least as an option.
Matt wrote a proof of concept that switches mongoexport to $uuid using a custom registry. It would be nicer, though, if this were in the driver natively.