mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-07-03 17:22:33 +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)
|
return fmt.Errorf("can't create find result: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer result.Close(d.Context())
|
|
||||||
var i int
|
var i int
|
||||||
|
|
||||||
for i = 0; result.Next(d.Context()); {
|
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)
|
targetSliceV = targetSliceV.Slice(0, i)
|
||||||
targetV.Elem().Set(targetSliceV)
|
targetV.Elem().Set(targetSliceV)
|
||||||
|
|
||||||
return nil
|
return result.Close(d.Context())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user