Sunday 21 May 2017

Node.js & Mongoose sorting problems

I'm trying to sort two articles by descending date. Can't undersand, why it doesn't sort it right.

My dates: 2016-05-17T09:59:00.000Z, 2017-05-03T10:00:00.000Z

My sorting mechanism: return this.model.find(parameters.filter).sort({createdAt: -1}).limit(parameters.top);

Where model is just mongoose.model.

Haven't got any idea what's wrong with it :( Appreciate your help!



via Nikita Savanovich

No comments:

Post a Comment