I have a DrawingHistory collection which stores data to be used for redrawing canvas data, but I can't seem to find a way to sort the information by a time property. Here's my current function
DrawingHistory.find().observeChanges
added: ( id , data ) =>
@setupUserDraw data unless Session.equals 'user_id' , data.sid
Sometimes the order gets messed up, and I looked online for sorting where people say to do DrawingHistory.find().sort( { time: -1 } ) but find() doesn't have a sort property. Any ideas where I'm off?
If my memory isn't failing me, this should do it, the first {} being the selector, the second {...} being the options.
DrawingHistory.find({}, {sort: {time: -1}});
EDIT: Found the docs on find().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With