v0.0.319 fix error when findoneÃ+pipeline fails
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m15s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m15s
This commit is contained in:
parent
1260b2dc77
commit
5ba84bd8ee
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.318"
|
||||
const GoextVersion = "0.0.319"
|
||||
|
||||
const GoextVersionTimestamp = "2023-11-13T15:34:58+0100"
|
||||
const GoextVersionTimestamp = "2023-11-13T16:45:00+0100"
|
||||
|
@ -81,13 +81,13 @@ func (c *Coll[TData]) findOneInternal(ctx context.Context, filter bson.M, allowN
|
||||
if cursor.Next(ctx) {
|
||||
v, err := c.decodeSingle(ctx, cursor)
|
||||
if err != nil {
|
||||
return nil, exerr.Wrap(err, "mongo-aggregation [find-one] failed").Any("pipeline", pipeline).Str("collection", c.Name()).Build()
|
||||
return nil, exerr.Wrap(err, "mongo-aggregation [find-one] failed to decode results").Any("pipeline", pipeline).Str("collection", c.Name()).Build()
|
||||
}
|
||||
return &v, nil
|
||||
} else if allowNull {
|
||||
return nil, nil
|
||||
} else {
|
||||
return nil, exerr.Wrap(err, "mongo-aggregation [find-one] failed").Any("pipeline", pipeline).Str("collection", c.Name()).Build()
|
||||
return nil, exerr.Wrap(mongo.ErrNoDocuments, "mongo-aggregation [find-one] returned no documents").Any("pipeline", pipeline).Str("collection", c.Name()).Build()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user