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.