Retrieve the fields info from the type elem but not the value elem

v2
Nikita Tokarchuk 4 years ago
parent 04382db4cd
commit e52b1bcc8a
No known key found for this signature in database
GPG Key ID: C4378F005530EDF2
  1. 6
      mongox/database/database.go

@ -126,8 +126,12 @@ func (d *Database) createAggregateLoad(target interface{}, composed *query.Query
pipeline = append(pipeline, primitive.M{"$limit": *composed.Limiter()}) pipeline = append(pipeline, primitive.M{"$limit": *composed.Limiter()})
} }
el := reflect.ValueOf(target).Elem() el := reflect.ValueOf(target)
elType := el.Type() elType := el.Type()
if elType.Kind() == reflect.Ptr {
elType = elType.Elem()
}
numField := elType.NumField() numField := elType.NumField()
preloads, _ := composed.Preloader() preloads, _ := composed.Preloader()

Loading…
Cancel
Save