I am stuck on page 3 of the Meteor tutorial 2015-04-16

I am currently on the 3rd stage of the meteors tutorial

The first error was the following command:

meteor mongo

      

According to google, this command is now failing due to a known bug.

So, I am working with this command:

mongo --port 3001

      

Then I tried this command from the mongo prompt:

dan@u77:~/mets/simple-todos $ 
dan@u77:~/mets/simple-todos $ 
dan@u77:~/mets/simple-todos $ mongo --port 3001
MongoDB shell version: 2.6.7
connecting to: 127.0.0.1:3001/test
meteor:PRIMARY> 
meteor:PRIMARY> db.tasks.insert({ text: "Hello world!", createdAt: new Date() });
WriteResult({ "nInserted" : 1 })
meteor:PRIMARY> 
meteor:PRIMARY> 

      

According to the tutorial, I should now see the task in the template.

But I can't see anything.

JAVASCRIPT

// simple-todos.js

Tasks = new Mongo.Collection("tasks");

if (Meteor.isClient) {
  // This code only runs on the client
  Template.body.helpers({
    tasks: function () {
      return Tasks.find({});
    }
  });
}

      

Html

<head>
  <title>Todo List</title>
</head>

<body>
  <div class="container">
    <header>
      <h1>Todo List</h1>
    </header>

    <ul>
      {{#each tasks}}
        {{> task}}
      {{/each}}
    </ul>
  </div>
</body>

<template name="task">
  <li>{{text}}</li>
</template>

      

+3


source to share


2 answers


I ran into this problem and the reason it didn't work was because I forgot to include tasks.js in servers / main.js :

  import '../imports/api/tasks.js';


This tutorial does this.

+2


source


I ran into this problem and it was because I removed autopublish. Make sure you have an auto-publishing package by running:



    meteor add autopublish 

      

+1


source







All Articles