I'm working on golang server, connected to mongo.
I have a the following reference structure:
type A struct {
Id bson.ObjectId `bson:"_id" json:"id"`
B bson.ObjectId `bson:"b,omitempty" json:"b,omitempty"`
}
Thing is, B is not mandatory in A, and when ever I try to save A without B i'm getting an error:
"Invalid ObjectId in JSON: null"
How can I have this reference be no mandatory?