date.go
func (d *Date) SetBSON(raw bson.Raw) error {
	var m bson.M
	if err := raw.Unmarshal(&m); err != nil {
		return err
	}

	if data, ok := m["data"].(string); ok {
		rd, err := time.Parse(RFC3339FullDate, data)
		*d = Date(rd)
		return err
	}

	return errors.New("couldn't unmarshal bson raw value as Date")
}
func (d *Date) SetBSON(raw bson.Raw) error {
	var m bson.M
	if err := raw.Unmarshal(&m); err != nil {
		return err
	}

	if data, ok := m["data"].(string); ok {
		rd, err := time.Parse(RFC3339FullDate, data)
		*d = Date(rd)
		return err
	}

	return errors.New("couldn't unmarshal bson raw value as Date")
}
func ( d * Date ) SetBSON ( raw bson . Raw ) error { var m bson . M if err := raw . Unmarshal ( & m ) ; err != nil { return err } if data , ok := m [ " " ] . ( string ) ; ok { rd , err := time . Parse ( RFC3339FullDate , data ) * d = Date ( rd ) return err } return errors . New ( " " ) }
// SetBSON sets the Date from raw bson data
SetBSON sets the Date from raw bson data