I am having trouble getting my very simple meteor tutorial to read my collections in Mongodb and print to the page. This is the official tutuorial found on meteor's website. Any help would be much appreciated. If anyone would like to connect to the workspace and make changes let me know and I can grant access.
Here is a link to my workspace: https://ide.c9.io/hilldesigns/meteor
Tasks = new Mongo.Collection("tasks");
if (Meteor.isClient) {
// This code only runs on the client
Template.body.helpers({
tasks: function () {
return Tasks.find({});
}
});
}
Here is the HTML markup:
<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>
Not sure about attaching a helper to the body, it's not supported in 1.2.1 ( the latest release ). If you open the console in your browser it should show an error about can't access helpers on undefined.
So, to make it work...
<head>
<title>Todo List</title>
</head>
<body>
<div class="container">
<header>
<h1>Todo List</h1>
</header>
{{> todos}}
</div>
</body>
<template name="todos">
<ul>
{{#each tasks}}
{{> task}}
{{/each}}
</ul>
</template>
<template name="task">
<li>{{text}}</li>
</template>
with
Tasks = new Mongo.Collection("tasks");
if (Meteor.isClient) {
// This code only runs on the client
Template.todos.helpers({
tasks: function () {
return Tasks.find({});
}
});
}
works fine
Here's my meteor list
autopublish 1.0.4 (For prototyping only) Publish the entire database to all clients
blaze-html-templates 1.0.1 Compile HTML templates into reactive UI with Meteor Blaze
ecmascript 0.1.6* Compiler plugin that supports ES2015+ in all .js files
es5-shim 4.1.14 Shims and polyfills to improve ECMAScript 5 support
insecure 1.0.4 (For prototyping only) Allow all database writes from the client
jquery 1.11.4 Manipulate the DOM using CSS selectors
meteor-base 1.0.1 Packages that every Meteor app needs
mobile-experience 1.0.1 Packages for a great mobile user experience
mongo 1.1.3 Adaptor for using MongoDB and Minimongo over DDP
session 1.1.1 Session variable
standard-minifiers 1.0.2 Standard minifiers used with Meteor apps by default.
tracker 1.0.9 Dependency tracker to allow reactive callbacks
and meteor is 1.2.1