globalsign / mgo

The MongoDB driver for Go
Other
1.97k stars 232 forks source link

Feature/omitalways #389

Closed Nifty255 closed 4 years ago

Nifty255 commented 4 years ago

A developer may wish to decode or otherwise assign to a struct field but not re-encode. For example, a MongoDB document struct with a struct pointer inside for relationships:

type User struct {
  Email     string    `bson:"email"`
  Sessions  []Session `bson:"sessions,omitalways"`
}

This is accomplished via the following set of implementations:

Nifty255 commented 4 years ago

Going to close this PR, move my changes to development, and create a new one.