This commit is contained in:
2023-06-07 16:58:17 +02:00
parent c7df9d2264
commit 45d4fd7101
12 changed files with 365 additions and 255 deletions

View File

@@ -1,6 +1,7 @@
package wmo
import (
"errors"
"go.mongodb.org/mongo-driver/bson"
ct "gogs.mikescher.com/BlackForestBytes/goext/cursortoken"
)
@@ -70,6 +71,10 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP
// false
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$eq": bson.A{"1", "0"}}}})
} else {
return nil, errors.New("unknown ct mode: " + string(token.Mode))
}
pipeline = append(pipeline, bson.D{{Key: "$sort", Value: sort}})