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

Decode at struct sub level won't working

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.3.1, 1.3.2
    • Component/s: CRUD
    • Labels:
      None

      At my struct have a sub level of document example

      type (  A struct {    ID  primitive.ObjectID `bson:"_id,omitempty"`    Title string `bson:"title"  }  B struct {     ID primitive.ObjectID `bson:"_id,omitempty"`     Title string `bson:"title"  }  C struct {     A     Bs []B `bson:"b"`  })

      when fetch data and decode data to struct C all of field return nil or empty
      but if i setup struct have all of field such as 

      type (
       C struct {
          ID primitive.ObjectID `bson:"_id,omitempty"` 
          Title string `bson:"title"
          Bs []struct{
             ID primitive.ObjectID `bson:"_id,omitempty"`
             Title string `bson:"title"
          } `bson:"b"`
       }
      )
      

      data return correctly 

      how to fix this problem or this is bug?

      thank you.

            Assignee:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Reporter:
            thanakrit.nsk@gmail.com Thanakrit Nawasaykaew
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: