From ac5ad640bdd66abd5af9983507565607bb0c99c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Thu, 22 Jun 2023 15:07:06 +0200 Subject: [PATCH] v0.0.166 --- wmo/queryList.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wmo/queryList.go b/wmo/queryList.go index 10358ce..c485290 100644 --- a/wmo/queryList.go +++ b/wmo/queryList.go @@ -3,6 +3,7 @@ package wmo import ( "context" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" ct "gogs.mikescher.com/BlackForestBytes/goext/cursortoken" ) @@ -11,9 +12,16 @@ func (c *Coll[TData]) List(ctx context.Context, filter ct.Filter, pageSize *int, return make([]TData, 0), ct.End(), nil } - pipeline := filter.FilterQuery() + pipeline := mongo.Pipeline{} + pf1 := "_id" + pd1 := ct.SortASC + pf2 := "_id" + pd2 := ct.SortASC - pf1, pd1, pf2, pd2 := filter.Pagination() + if filter != nil { + pipeline = filter.FilterQuery() + pf1, pd1, pf2, pd2 = filter.Pagination() + } sortPrimary := pf1 sortDirPrimary := pd1