[GODRIVER-2591] Make all BSON types (bson.D, bson.M, bson.Regex, etc) default string representation Extended JSON Created: 15/Oct/22  Updated: 08/Jan/24

Status: Backlog
Project: Go Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: 2.0.0

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on GODRIVER-2618 Create an "extjson" package for the E... Closed
Related
related to GODRIVER-2790 Make "bson.D" implement "json.Marshal... Closed
is related to GODRIVER-1765 Add MarshalJSON/UnmarshalJSON functio... Backlog
Epic Link: Go Driver 2.0 BSON
Quarter: FY24Q3
Backwards Compatibility: Major Change
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Currently the standard string representation of the bson.D and bson.M types is not overridden and simply uses the formatter default representation. However, printing extended JSON would be much more useful because it doesn't lose type information and is human-readable and standardized.

This is a backward-breaking change so cannot be completed in the v1.x Go Driver.

See a Go playground example of the default string representations, JSON, and extended JSON representations.

Definition of done:

  • The bson.D.String and bson.M.String functions should return a relaxed Extended JSON representation of the document.
  • All Go types that implement BSON types (e.g. Regex, ObjectID, etc) have a String function that returns valid relaxed Extended JSON representation of the value.

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