Pub/Sub Help for a noob


#1

Dear all,
I’m doing the intermediate tutotial from leveluptuts. I’m told to be an experienced developper and this is not my first tutorial. Unfortunatelly I bumping into a blocking “Challenge”. None of the record that are published are visible on the client and I do not know where to look.

I logging the number of records published, I’m loggin a line just before the subscribe get called. I’m checking the console log on the client and everyting seem to work…
I have installed meteor toys and there I can see my subscription… But it is empty. Fetching the records on the client give me an empty array…

If someone could have a look at the code and tell me what I’m a doing wrong I would gretly appreciate it. :slight_smile:

The code can be find on my github account: alexandreroba and the repo is recipebook.

Simply clone it and launch meteor.
You can then navigate to http://localhost:3000/recipe-book create an account.
Publish a recipe by feeling the name, description and an ingredient…

Thanks a lot.


#2

You forgot to return you Recipes

Meteor.publish('myRecipes', function () {
    let count = Recipes.find({author:this.userId}).count();
    console.log(`Published recipes:${count}`);
    return Recipes.find({author:this.userId});
});

#3

No kinding! Thanks A LOT for that. I spend couple of hours trying to figure this out. I tried to debug, tested on other laptops… and it was simply the missing return. Again thanks.


#4

No worry it happened to me as well when I started Meteor