Closed egemon closed 6 years ago
Sorting relies on mongo sort which orders the results by a specific field (not by an aggregation). If your score property is an array, sorting by it won't work. If the score property is an object containing 2 properties (upvotes & downvotes), you can sort by score.upvotes. If you want to sort by overall score, you should keep that number in a property (which should be updated with each upvote/downvote) and sort by it.
I have an array of vote objects as a field of post. I am using meteor-collection-helpers to get number of upvotes and downvotes from this array. I need to sort by this number. Neither
{score: 1}
or{score(): 1}
is not working. Is this issues with subscription or with pagination or am i doing smth wrong?https://github.com/dburles/meteor-collection-helpers @Kurounin