From 9c8cde384f976820ee3f4aef11e8cfdebf10e2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Thu, 8 Aug 2024 15:57:05 +0200 Subject: [PATCH] v0.0.505 --- go.mod | 2 +- go.sum | 2 ++ goextVersion.go | 4 ++-- wmo/queryFindOne.go | 14 +++++++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index f9db570..a279231 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/jmoiron/sqlx v1.4.0 github.com/rs/xid v1.5.0 github.com/rs/zerolog v1.33.0 - go.mongodb.org/mongo-driver v1.16.0 + go.mongodb.org/mongo-driver v1.16.1 golang.org/x/crypto v0.26.0 golang.org/x/sys v0.23.0 golang.org/x/term v0.23.0 diff --git a/go.sum b/go.sum index 6be7203..fe6c75f 100644 --- a/go.sum +++ b/go.sum @@ -234,6 +234,8 @@ go.mongodb.org/mongo-driver v1.15.1 h1:l+RvoUOoMXFmADTLfYDm7On9dRm7p4T80/lEQM+r7 go.mongodb.org/mongo-driver v1.15.1/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.mongodb.org/mongo-driver v1.16.0 h1:tpRsfBJMROVHKpdGyc1BBEzzjDUWjItxbVSZ8Ls4BQ4= go.mongodb.org/mongo-driver v1.16.0/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw= +go.mongodb.org/mongo-driver v1.16.1 h1:rIVLL3q0IHM39dvE+z2ulZLp9ENZKThVfuvN/IiN4l8= +go.mongodb.org/mongo-driver v1.16.1/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= diff --git a/goextVersion.go b/goextVersion.go index 3b163c7..7d60993 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.504" +const GoextVersion = "0.0.505" -const GoextVersionTimestamp = "2024-08-07T19:44:45+0200" +const GoextVersionTimestamp = "2024-08-08T15:57:05+0200" diff --git a/wmo/queryFindOne.go b/wmo/queryFindOne.go index 8bc4681..55212b6 100644 --- a/wmo/queryFindOne.go +++ b/wmo/queryFindOne.go @@ -12,7 +12,11 @@ import ( func (c *Coll[TData]) FindOne(ctx context.Context, filter bson.M) (TData, error) { r, err := c.findOneInternal(ctx, filter, false) if err != nil { - return *new(TData), exerr.Wrap(err, "mongo-query[find-one] failed").Str("collection", c.Name()).Build() + if filterId, ok := filter["_id"]; ok { + return *new(TData), exerr.Wrap(err, "mongo-query[find-one] failed").Str("collection", c.Name()).Any("filter", filter).Any("filter_id", filterId).Build() + } else { + return *new(TData), exerr.Wrap(err, "mongo-query[find-one] failed").Str("collection", c.Name()).Any("filter", filter).Build() + } } return *r, nil @@ -21,7 +25,7 @@ func (c *Coll[TData]) FindOne(ctx context.Context, filter bson.M) (TData, error) func (c *Coll[TData]) FindOneOpt(ctx context.Context, filter bson.M) (*TData, error) { r, err := c.findOneInternal(ctx, filter, true) if err != nil { - return nil, exerr.Wrap(err, "mongo-query[find-one-opt] failed").Str("collection", c.Name()).Build() + return nil, exerr.Wrap(err, "mongo-query[find-one-opt] failed").Str("collection", c.Name()).Any("filter", filter).Build() } return r, nil @@ -58,7 +62,11 @@ func (c *Coll[TData]) findOneInternal(ctx context.Context, filter bson.M, allowN return nil, nil } if err != nil { - return nil, exerr.Wrap(err, "mongo-query[find-one] failed").Any("filter", filter).Str("collection", c.Name()).NoLog().Build() + if filterId, ok := filter["_id"]; ok { + return nil, exerr.Wrap(err, "mongo-query[find-one|internal] failed").Str("collection", c.Name()).Any("filter", filter).Any("filter_id", filterId).NoLog().Build() + } else { + return nil, exerr.Wrap(err, "mongo-query[find-one|internal] failed").Str("collection", c.Name()).Any("filter", filter).NoLog().Build() + } } return &res, nil