Skip to content

Conversation

@wxf4150
Copy link

@wxf4150 wxf4150 commented Feb 28, 2019

this commit fixes #36

@wxf4150
Copy link
Author

wxf4150 commented Feb 28, 2019

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.02%) to 84.064% when pulling 6721120 on wxf4150:master into 761759e on go-bongo:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.02%) to 84.064% when pulling 6721120 on wxf4150:master into 761759e on go-bongo:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.02%) to 84.064% when pulling 6721120 on wxf4150:master into 761759e on go-bongo:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.02%) to 84.064% when pulling 6721120 on wxf4150:master into 761759e on go-bongo:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collection.Save CascadeSave bug

2 participants