[GODRIVER-2745] Improve usability of BSON binary types' "DebugString" output Created: 02/Feb/23  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

Epic Link: Go Driver 2.0 BSON
Quarter: FY24Q3

 Description   

The DebugString methods in the bson package can be extremely useful for inspecting the structure of BSON documents in human-readable form. However, the output format could be better and the bson.Raw type is missing a DebugString method.

Definition of done:

  • Change DebugString output format to something like

    document(len=length){ [type] "key" value, [type2] "key2" value2, ... }
    

    E.g. output:

    document(len=76){ [string] "key1" value, [64-bit integer] "key2" 1234, [UTC datetime] "key3" 1675282389, [embedded document] "key4" document(len=24){ [string] "nested" "value2" } }
    

  • Recursively convert nested values to DebugString format if it defines DebugString.
  • Add a DebugString method to the bson.Raw type.

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