Skip to content

CascadeSave should sync#40

Open
wxf4150 wants to merge 3 commits into
go-bongo:masterfrom
wxf4150:master
Open

CascadeSave should sync#40
wxf4150 wants to merge 3 commits into
go-bongo:masterfrom
wxf4150:master

Conversation

@wxf4150

@wxf4150 wxf4150 commented Feb 28, 2019

Copy link
Copy Markdown

this commit fixes #36

@wxf4150

wxf4150 commented Feb 28, 2019

Copy link
Copy Markdown
Author

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
Copy Markdown

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
Copy Markdown

Coverage Status

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

@coveralls

Copy link
Copy Markdown

Coverage Status

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

@coveralls

Copy link
Copy Markdown

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