Closed danvixent closed 2 years ago
Hey @danvixent, the default sorting order for badgerhold is ascending. For your case data returned from that query will return the earliest created records first (lowest CreatedAt
value).
For reversing that behaviour you should call the Reverse
function like that: q.SortBy("CreatedAt").Reverse()
.
Thanks for answering @b-tarczynski, and everything you say is accurate with a few caveats.
The default order is ascending based on the the byte order
, which for the most part works the way you expect, however depending on the type of encoding you use, it may be in an unexpected order.
Thanks @b-tarczynski @timshannon!
when i do
And CreatedAt is unix timestamp, i need to know the order in which badgerhold sorts the data based on that field.
Thanks in advance!