21
0
Fork 0

v0.0.319 fix error when findoneÃ+pipeline fails
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m15s Details

This commit is contained in:
Mike Schwörer 2023-11-13 16:45:00 +01:00
parent 1260b2dc77
commit 5ba84bd8ee
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 4 additions and 4 deletions

View File

@ -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"

View File

@ -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()
}
}
}