From c7df9d226417583639db101fa90b26fc8f0a7a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 7 Jun 2023 12:59:15 +0200 Subject: [PATCH] v0.0.146 --- goextVersion.go | 4 ++-- wmo/pagination.go | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/goextVersion.go b/goextVersion.go index 7257196..5dae375 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.145" +const GoextVersion = "0.0.146" -const GoextVersionTimestamp = "2023-06-07T12:45:48+0200" +const GoextVersionTimestamp = "2023-06-07T12:59:15+0200" diff --git a/wmo/pagination.go b/wmo/pagination.go index ad60859..2d70c22 100644 --- a/wmo/pagination.go +++ b/wmo/pagination.go @@ -57,7 +57,20 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP pipeline := make([]bson.D, 0, 3) - pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}}) + if token.Mode == ct.CTMStart { + + // no gt/lt condition + + } else if token.Mode == ct.CTMNormal { + + pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}}) + + } else if token.Mode == ct.CTMEnd { + + // false + pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$eq": bson.A{"1", "0"}}}}) + + } pipeline = append(pipeline, bson.D{{Key: "$sort", Value: sort}})