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