Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2702

bsoncore.Value#String() should persist timestamp types

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.11.2
    • Affects Version/s: None
    • Component/s: None
    • None

      "bsoncore.Value#String()" is meant be extended JSON but stringifies the timestamp uint32 values for I and U which is antethesis of the expected behavior. This effects both bson.Raw#String() and bson.RawValue#String(). Decoding the stringified value of either will result in the following error:

      var doc bson.Raw
      if err := bson.UnmarshalExtJSON([]byte(cmdCopy.String()), true, &doc); err != nil {
              // panic: error: $timestamp t value should be uint32, but instead is string
      	panic(fmt.Sprintf("error: %v", err)) 
      }
      

            Assignee:
            preston.vasquez@mongodb.com Preston Vasquez
            Reporter:
            preston.vasquez@mongodb.com Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: