mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-05-22 15:53:36 +00:00
Handle cursor error
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user