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

ObjectID returned as '000000000000000000000000'

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Gone away
    • Icon: Major - P3 Major - P3
    • None
    • 0.3.0
    • BSON
    • None
    • OS X 10.14.3

    Description

      When querying documents with fields storing ObjectIDs, occasionally the ObjectID is returned as: ObjectID("000000000000000000000000"). The actual id in a particular record is: "5c7fd4bbd30c2768159c7119"

      The struct looks like:

      type Quote struct { 
        ID primitive.ObjectID `bson:"_id" json:"id"`   
        CustomerID primitive.ObjectID `bson:"customerID" json:"customerID"`  
        Discount   *Discount          `bson:"discount" json:"discount,omitempty"`  
        Features   string             `json:"features"`
        JobsheetID primitive.ObjectID `bson:"jobsheetID" json:"jobsheetID"`  
        Number     int                `bson:"number" json:"number"`  
       ...
      }
      
      

      The field that is returned with the 0's is JobsheetID. Oddly the CustomerID is good as is the ID, all of the same ObjectID type. I'm able to successfully query the table referencing the JobsheetID by it's proper _id (ID) and the return results for the ID is good.

      Baffled here, I'm attempting to switch from a mgo driver but can't proceed with this issue.

      Attachments

        Activity

          People

            isabella.siu@mongodb.com Isabella Siu (Inactive)
            rond@webbtech.net Ron Dyck
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: