Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
1.0.0
-
None
-
Ubuntu 18.04 amd64
Description
I declare schemas. For example:
type Embedded struct {
|
Name string `bson:"name"`
|
}
|
|
|
type Main struct {
|
Embedded
|
OtherField int64 `bson:"otherField"`
|
}
|
When I try to load an instance of Main structure from the database, e.g.:
cursor, err := client.Database("my").Collection("myColl").Find(context.TODO(), bsonD{})
|
|
|
if err != nil {
|
return err
|
}
|
|
|
for cursor.Next(context.TODO()) {
|
var m Main
|
if err := cursor.Decode(&m); err != nil {
|
return err
|
}
|
|
|
fmt.Printf("name=\"%s\"\n", m.Name) // outputs `name=""`
|
}
|