Handle cursor error

v2
Nikita Tokarchuk 5 years ago
parent f1fe41d336
commit 0b313e82fb
  1. 3
      mongox/database/loadarray.go

@ -48,7 +48,6 @@ func (d *Database) LoadArray(target interface{}, filters ...interface{}) error {
return fmt.Errorf("can't create find result: %w", err)
}
defer result.Close(d.Context())
var i int
for i = 0; result.Next(d.Context()); {
@ -73,5 +72,5 @@ func (d *Database) LoadArray(target interface{}, filters ...interface{}) error {
targetSliceV = targetSliceV.Slice(0, i)
targetV.Elem().Set(targetSliceV)
return nil
return result.Close(d.Context())
}

Loading…
Cancel
Save