Discover Meteor chapter 13 sorting algorithm not working


#1

Hi,

I’m just starting with meteor (and programming) and I am having problems with the sorting in Chapter 13 (Upvoting).
It should sort the to 5 pages based on the number of votes. Currently the sort order is:

  1. 2 votes
  2. 2 votes
  3. 1 vote
  4. 2 votes
  5. 2 votes

I already tried debugging, but still failing miserably because I cannot figure out where the query is built and where it is executed.
So I would still have problems pinpointing to where to problematic code is.
I have a github repository where my current state is available.
Personal Github 13-5

Offical discovermeteor github commit

It would be great if someone could pinpoint me to where I should look, how to debug it or what line(s) are problematic.


#2

Looking at publications.js the posts publication takes an options object.

Next, check out the subscription (somewhere where it says Meteor.subscribe) and see what options object is being sent in.


#3

Thx for the help.
I found the Problem. I had a helper which it seems was used instead of the new parts in the router without the options object.

Template.postsList.helpers({
posts: function() {
    var postle = Posts.find({}, {sort: {submitted: -1}});
    return postle;
}});