Compare commits

..

2 Commits

Author SHA1 Message Date
8528b5cb66 v0.0.320 bugfix sort
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m14s
2023-11-14 14:50:27 +01:00
5ba84bd8ee 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
2023-11-13 16:45:00 +01:00
3 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.318" const GoextVersion = "0.0.320"
const GoextVersionTimestamp = "2023-11-13T15:34:58+0100" const GoextVersionTimestamp = "2023-11-14T14:50:27+0100"

View File

@@ -81,13 +81,13 @@ func (c *Coll[TData]) findOneInternal(ctx context.Context, filter bson.M, allowN
if cursor.Next(ctx) { if cursor.Next(ctx) {
v, err := c.decodeSingle(ctx, cursor) v, err := c.decodeSingle(ctx, cursor)
if err != nil { 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 return &v, nil
} else if allowNull { } else if allowNull {
return nil, nil return nil, nil
} else { } 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()
} }
} }
} }

View File

@@ -42,7 +42,7 @@ func (c *Coll[TData]) Paginate(ctx context.Context, filter pag.Filter, page int,
pipelineCount := mongo.Pipeline{} pipelineCount := mongo.Pipeline{}
pipelineCount = append(pipelineCount, bson.D{{Key: "$count", Value: "count"}}) pipelineCount = append(pipelineCount, bson.D{{Key: "$count", Value: "count"}})
pipelineList := langext.ArrConcat(pipelineFilter, pipelineSort, pipelinePaginate, c.extraModPipeline) pipelineList := langext.ArrConcat(pipelineFilter, pipelineSort, pipelinePaginate, c.extraModPipeline, pipelineSort)
pipelineTotalCount := langext.ArrConcat(pipelineFilter, pipelineCount) pipelineTotalCount := langext.ArrConcat(pipelineFilter, pipelineCount)
cursorList, err := c.coll.Aggregate(ctx, pipelineList) cursorList, err := c.coll.Aggregate(ctx, pipelineList)