From 6c4af4006b0faa62ffc1ae1fe764b19f64601139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 24 Mar 2024 15:25:52 +0100 Subject: [PATCH] v0.0.423 fix createPaginationPipeline - different primary and secondary sort keys broke mongo ??!?? - it actually only sorted by the secondary condition (ignoring the primary?) --- goextVersion.go | 4 ++-- wmo/queryList.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/goextVersion.go b/goextVersion.go index 7310ac2..2e89a07 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.422" +const GoextVersion = "0.0.423" -const GoextVersionTimestamp = "2024-03-23T20:29:46+0100" +const GoextVersionTimestamp = "2024-03-24T15:25:52+0100" diff --git a/wmo/queryList.go b/wmo/queryList.go index eeba6d8..1297c8c 100644 --- a/wmo/queryList.go +++ b/wmo/queryList.go @@ -171,7 +171,7 @@ func createPaginationPipeline[TData any](coll *Coll[TData], token ct.CursorToken bson.M{*fieldSecondary: bson.M{"$gt": valueSecondary}}, }}) - sort = append(sort, bson.E{Key: fieldPrimary, Value: +1}) + sort = append(sort, bson.E{Key: *fieldSecondary, Value: +1}) } else if *sortSecondary == ct.SortDESC { @@ -181,7 +181,7 @@ func createPaginationPipeline[TData any](coll *Coll[TData], token ct.CursorToken bson.M{*fieldSecondary: bson.M{"$lt": valueSecondary}}, }}) - sort = append(sort, bson.E{Key: fieldPrimary, Value: -1}) + sort = append(sort, bson.E{Key: *fieldSecondary, Value: -1}) } }