I would like to sort a minimongo cursor using a date field. It appears that $orderBy
will be deprecated according to the mongoDB documentation (not that I know if it works with minimongo) and sort()
does not seem to work.
Is there a way to sort a minimongo cursor using a date field or should I rely on plain Javascript/underscore (Sorting by date with underscore.js or just plain JS)?
It turns out that
sort
is supported, I just didn't get the syntax right. It would look like this:Edit: more generally, 1 is for ascending and -1 is for descending. (for future readers, as noted by @BlazeSahlzen in comments)