This commit is contained in:
Mike Schwörer 2023-06-07 12:59:15 +02:00
parent d0954bf133
commit c7df9d2264
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 16 additions and 3 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.145"
const GoextVersion = "0.0.146"
const GoextVersionTimestamp = "2023-06-07T12:45:48+0200"
const GoextVersionTimestamp = "2023-06-07T12:59:15+0200"

View File

@ -57,7 +57,20 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP
pipeline := make([]bson.D, 0, 3)
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}})
if token.Mode == ct.CTMStart {
// no gt/lt condition
} else if token.Mode == ct.CTMNormal {
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}})
} else if token.Mode == ct.CTMEnd {
// false
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$eq": bson.A{"1", "0"}}}})
}
pipeline = append(pipeline, bson.D{{Key: "$sort", Value: sort}})