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

Cannot decode when any ObjectId field is null in database

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.1.0
    • Affects Version/s: 0.0.16
    • Component/s: BSON

      I don't know exactly in which alpha version this issue started, but when decoding the *DocumentResult into my Go struct, it always throws an error if I have 
      "myIdAttribute": null in database.

      • If struct is defined as *objectid.ObjectID, decoding fails. The error contains this relevant info: "github.com/mongodb/mongo-go-driver/bson/objectid.ObjectID.IsZero called using nil *ObjectID pointer"
      • If struct is defined using objectid.ObjectID (no pointer here), it also fails. The error message contains: "cannot decode null into an ObjectID"

      So basically in case any field in my database represents an ObjectID, and its value is null in the database, my entire decode operation fails.

            Assignee:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Reporter:
            bazaglia Andre Bazaglia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: