Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to add sparse annotation support to model field #28

Open
tearsofphoenix opened this issue Jul 6, 2018 · 0 comments
Open

Need to add sparse annotation support to model field #28

tearsofphoenix opened this issue Jul 6, 2018 · 0 comments

Comments

@tearsofphoenix
Copy link

Problem:

type ModelA struct {
	mongodm.DocumentBase `json:",inline" bson:",inline"`

	Target bson.ObjectId `json:"target" bson:"target"`
}

if create a ModelA but leave target field empty, when try to save the document, error occured:
ObjectIDs must be exactly 12 bytes long (got 0). So, maybe need add something like this:

Target bson.ObjectId `sparse:"true"`

?

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

No branches or pull requests

1 participant