Update dal/mongo/dal.go
This commit is contained in:
parent
d922540d0a
commit
d5d8346375
@ -504,7 +504,7 @@ func (d *DAL) YieldMessages(
|
|||||||
yield func(ticket model.Message) error) error {
|
yield func(ticket model.Message) error) error {
|
||||||
cursor, err := d.colMsg.Find(ctx, bson.M{
|
cursor, err := d.colMsg.Find(ctx, bson.M{
|
||||||
"TicketID": ticketID,
|
"TicketID": ticketID,
|
||||||
}, options.Find().SetLimit(20).SetSort(bson.D{{"CreatedAt", -1}}))
|
}, options.Find().SetLimit(20).SetSort(bson.D{{"CreatedAt", 1}}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -689,7 +689,7 @@ func (d *DAL) GetMessagesPage(ctx context.Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort := bson.D{{"UpdatedAt", 1}}
|
sort := bson.D{{"CreatedAt", -1}}
|
||||||
|
|
||||||
cur, err := d.colMsg.Find(ctx, query, options.Find().SetLimit(limit).SetSkip(limit*offset).SetSort(sort))
|
cur, err := d.colMsg.Find(ctx, query, options.Find().SetLimit(limit).SetSkip(limit*offset).SetSort(sort))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user