v0.0.302
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m41s

This commit is contained in:
Mike Schwörer 2023-11-08 18:53:02 +01:00
parent 62c9a4e734
commit 7413ea045d
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
package goext 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"

View File

@ -36,9 +36,11 @@ func (c *Coll[TData]) Paginate(ctx context.Context, filter pag.Filter, page int,
} }
pipelinePaginate := mongo.Pipeline{} pipelinePaginate := mongo.Pipeline{}
pipelinePaginate = append(pipelinePaginate, bson.D{{Key: "$skip", Value: page - 1}})
if limit != nil { if limit != nil {
pipelinePaginate = append(pipelinePaginate, bson.D{{Key: "$skip", Value: *limit * (page - 1)}})
pipelinePaginate = append(pipelinePaginate, bson.D{{Key: "$limit", Value: *limit}}) pipelinePaginate = append(pipelinePaginate, bson.D{{Key: "$limit", Value: *limit}})
} else {
page = 1
} }
pipelineCount := mongo.Pipeline{} pipelineCount := mongo.Pipeline{}