Open wxf4150 opened 5 years ago
DocumentBase fields should omitempty; then the sub struct can used as bongo.Find param.
type User struct {
bongo.DocumentBase `bson:",inline"`
UserName string `example:"wxf"`
Password string `json:"-" example:"111111" bson:",omitempty"`
Phone string ` bson:",omitempty"`
Email string ` bson:",omitempty"`
}
u:=new(User)
err:=bgoUser.FindOne(bson.M{"username":uname},u)
err:=bgoUser.FindOne(User{UserName:uname},u) // if DocumentBase fields bson omitempty; then this line will work too.
this commit fixes #36