ensure that fields tagged with bson:"-" are never considered during querying

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-03-25 16:20:24 -04:00
parent cd72703068
commit d66f9dd4aa
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -126,7 +126,7 @@ func populate(r Reference, rcoll string, rawDoc interface{}, d string, src inter
tag, err := structtag.Parse(string(ff.Tag)) tag, err := structtag.Parse(string(ff.Tag))
if err == nil { if err == nil {
val, err2 := tag.Get("bson") val, err2 := tag.Get("bson")
if err2 == nil { if err2 == nil && val.Name != "-" {
fttt := ff.Type fttt := ff.Type
if fttt.Kind() == reflect.Pointer || fttt.Kind() == reflect.Slice { if fttt.Kind() == reflect.Pointer || fttt.Kind() == reflect.Slice {
fttt = fttt.Elem() fttt = fttt.Elem()
@ -175,6 +175,7 @@ func populate(r Reference, rcoll string, rawDoc interface{}, d string, src inter
src = t src = t
toReturn = src toReturn = src
} }
t.setExists(true)
} }
if toReturn == nil { if toReturn == nil {