From 19c7e22ced19f488c98c8a82dcc10d9664b4354d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 16 Sep 2024 17:39:18 +0200 Subject: [PATCH] v0.0.514 fix mongo filter where the primary sort key is null in db (fallback to secondary) --- goextVersion.go | 4 ++-- wmo/queryList.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/goextVersion.go b/goextVersion.go index 8052ec3..e26ba8f 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.513" +const GoextVersion = "0.0.514" -const GoextVersionTimestamp = "2024-09-16T15:27:32+0200" +const GoextVersionTimestamp = "2024-09-16T17:39:18+0200" diff --git a/wmo/queryList.go b/wmo/queryList.go index 37d0214..112f2a7 100644 --- a/wmo/queryList.go +++ b/wmo/queryList.go @@ -215,7 +215,7 @@ func createPaginationPipeline[TData any](coll *Coll[TData], token ct.CursorToken // the conflict-resolution condition, for entries with the _same_ as the $primary we take the ones with a greater $secondary (= newer) cond = append(cond, bson.M{"$and": bson.A{ - bson.M{fieldPrimary: valuePrimary}, + bson.M{"$or": bson.A{bson.M{fieldPrimary: valuePrimary}, bson.M{fieldPrimary: nil}}}, bson.M{*fieldSecondary: bson.M{"$gt": valueSecondary}}, }}) @@ -225,7 +225,7 @@ func createPaginationPipeline[TData any](coll *Coll[TData], token ct.CursorToken // the conflict-resolution condition, for entries with the _same_ as the $primary we take the ones with a smaller $secondary (= older) cond = append(cond, bson.M{"$and": bson.A{ - bson.M{fieldPrimary: valuePrimary}, + bson.M{"$or": bson.A{bson.M{fieldPrimary: valuePrimary}, bson.M{fieldPrimary: nil}}}, bson.M{*fieldSecondary: bson.M{"$lt": valueSecondary}}, }})