Do not increase offset if obj was not appended

v2
Nikita Tokarchuk 5 years ago
parent a49dc735e9
commit aeb273738d
  1. 2
      mongox/common/loadarray.go

@ -53,6 +53,8 @@ func LoadArray(db *mongox.Database, target interface{}, filters ...interface{})
elem := reflect.New(targetSliceElemT.Elem())
if result.Decode(elem.Interface()) != nil {
targetSliceV = reflect.Append(targetSliceV, elem)
} else {
continue
}
} else {
result.Decode(targetSliceV.Index(i).Interface())

Loading…
Cancel
Save