Where is the checked property of task defined?

I’m a newbie to Meteor, After I finish reading the tutorial, I have one question related to this step , this page says task has a property named checked,

if the checked property of a task is true, the checked class is added to our list item.

But to my understanding, a task has two properties: text and createdAt.

Where is the property checked defined? Thanks in advance.

If you check the final js file here:

https://github.com/meteor/simple-todos/blob/master/simple-todos.js

its there on the collection… but it does not seem to be in the tutorial, at least that i can see.

It seams that it does not exist in the beginning…

but after you do an update…

Tasks.update(this._id, { $set: {checked: ! this.checked} });

its there

read the part: “Checking off and deleting tasks”

dont forget with mongo, there is no predefined schema. you can add properties has you go along…

Got it , thank you very much!

Mongo doesn’t require a predefined schema for a document, just like JSON, so we can add fields whenever we want.

So the checked property is add by the Tasks.update

One more question.

When the browser loads the TODO web page the first time, the Tasks.update() doesn’t get called yet, all task have no property named checked, while simple-todos.html tries to get the value of checked, it won’t get a NullPointerException like in Java, instead, I guess, it will get a default value if checked doesn’t exist, right?

if not mistaken it returns null, so that {{#if checked}} still works :smile:, null or false it will not be checked

All clear now, thank you!