Simple todo application trouble

Hello all, I’m a meteorjs newbie and I’m trying to create simple Todo application.

When I’m trying to add a new entry I get an error:

“VM1985:1 Uncaught ReferenceError: Todos is not defined(…)”.

Here is my code:

This is from main.js

Todos = new Mongo.Collection('todos');

		return Todos.find();	

Where have I made a mistake ? Thanks in advance.

It seems like you’re trying to access the Todos collection somewhere else. Can you provide more context/information?

1 Like

Here is the all code I have been doing:


<div class="col-lg-12">
<template name="main">
  this is the main template

and this is from server/main.js

import { Meteor } from 'meteor/meteor';

Meteor.startup(() => {
  // code to run on server at startup

Hi. It appears from the code you provided that you have not defined the Todos collection on the server (you need to define collections on both the client and the server).

You might want to go through the tutorial to get some clarification on how to set up collections and perhaps structure your files differently.

1 Like

Hi thoragio.
I was following this tutorial on meteor Todo app. Is this version outdated ?

Yes, in the second video it shows that meteor version was installed. The current version is 1.4.1. For a more up-to-date version of the tutorial you can look here. Additionally, I can recommend the meteor guide.

1 Like

You should keep your collection definitions within a directory called lib. You want your collection definitions to be available on both the client, and the server. As others have said, if you read the meteor guide it explains virtually everything.

Will do. Thanks for your reply jpmoyn and everybody else.