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

Restore and clarify use of IsZero method when encoding BSON struct fields

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.14.0, 1.13.2
    • Affects Version/s: 1.13.0, 1.14.0
    • Component/s: BSON
    • None
    • Go Drivers
    • Not Needed
    • Hide

      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?

      Show
      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?

      Context

      The description of the behavior of the omitempty struct tag when handling structs can be misleading. Additionally v1.14.0 removed the language that describes the interaction between the omitempty struct tag and struct fields, which should be re-added for additional clarification.

      See this forum post for more context.

      Definition of done

      • Add a note to the description of the BSON omitempty struct tag that describes how struct fields are treated, specifically the use of bsoncodec.Zeroer. Note that struct values and struct pointer values both check bsoncodec.Zeroer to determine "emptiness".

      Pitfalls

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: