From 7413ea045dc2c5b9d6371aff4c761fff8829e5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 8 Nov 2023 18:53:02 +0100 Subject: [PATCH] v0.0.302 --- goextVersion.go | 4 ++-- wmo/queryPaginate.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/goextVersion.go b/goextVersion.go index 6a522e4..5226c92 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.301" +const GoextVersion = "0.0.302" -const GoextVersionTimestamp = "2023-11-08T18:30:30+0100" +const GoextVersionTimestamp = "2023-11-08T18:53:02+0100" diff --git a/wmo/queryPaginate.go b/wmo/queryPaginate.go index 87b6fba..51599ee 100644 --- a/wmo/queryPaginate.go +++ b/wmo/queryPaginate.go @@ -36,9 +36,11 @@ func (c *Coll[TData]) Paginate(ctx context.Context, filter pag.Filter, page int, } pipelinePaginate := mongo.Pipeline{} - pipelinePaginate = append(pipelinePaginate, bson.D{{Key: "$skip", Value: page - 1}}) if limit != nil { + pipelinePaginate = append(pipelinePaginate, bson.D{{Key: "$skip", Value: *limit * (page - 1)}}) pipelinePaginate = append(pipelinePaginate, bson.D{{Key: "$limit", Value: *limit}}) + } else { + page = 1 } pipelineCount := mongo.Pipeline{}