Sort by date in route


#1

MiniMongo is not sorting by date on client using latest Meteor. How do I sort by date (inserted using new Date() ) inside of a route subscription? below code had no effect on sort order. I want the items sorted by newest date first and then the limit applied.

Thanks,
Donnie

subscriptions: function() {
    //this.next();
    this.itemsSub = Meteor.subscribe('items',this.findFilter(), { limit:100, sort:{createdDate:-1} });
}

#2

How do you get to the documents in the collection? Are you using a helper? Or a data function in your route?


#3

I’m thinking that it may be because new Date() instantiates a Date object, which is likely not sortable in (mini)mongo.

Have you tried Date.now(), which returns an integer?