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

Empty slice no longer encoding/decoding as nil in 1.13.0 and 1.12.2

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.13.2
    • Affects Version/s: 1.13.0, 1.12.2, 1.13.1
    • Component/s: BSON
    • None
    • 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?

      Detailed steps to reproduce the problem?

      See attached test.go file. When inserting an empty slice, it would previously end up being decoded as nil but after GODRIVER-2914 and https://github.com/mongodb/mongo-go-driver/pull/1323 that now changed and it's now decoded as an empty slice.

      test.go

      Definition of done: what must be done to consider the task complete?

      The Release Notes should be updated to denote this change in 1.13.x and an option should be added to restore the old behavior. It should be removed from 1.12.x as I believe it's a breaking change.

      The exact Go version used, with patch level:

      $ go version

      This is happening with 1.22rc1 and 1.21.5.

      The exact version of the Go driver used:

      $ go list -m go.mongodb.org/mongo-driver

       

      I tested with 1.31.0, 1.31.1, 1.12.0 and every commit in between to determine when it broke.

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      N/A

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      N/A

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            james@getadmiral.com James Hartig
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: