watchlists: sort query results by _id descending

This commit is contained in:
Florian Schlegel 2020-10-08 13:56:42 +02:00
parent 15a2a4c466
commit a1fa04040f

View File

@ -179,7 +179,7 @@ func findOne(addrKey, sessionID string) (*CustomerWatchLists, error) {
}
customerWatchLists := &CustomerWatchLists{}
err := collection.Find(find).One(customerWatchLists)
err := collection.Find(find).Sort("-_id").One(customerWatchLists)
if err != nil {
return nil, err
}
@ -194,7 +194,7 @@ func findOneByQuery(query *bson.M) (*CustomerWatchLists, error) {
defer session.Close()
customerWatchLists := &CustomerWatchLists{}
err := collection.Find(query).One(customerWatchLists)
err := collection.Find(query).Sort("-_id").One(customerWatchLists)
if err != nil {
return nil, err
}