Unexpected token error after defining Aldeed SimpleSchema (Collection2)


#1

Meteor ERROR:
Errors prevented startup:
While processing files with ecmascript (for target web.browser):
collections/recipes.js:25:1: Unexpected token, expected “,” (25:1)

While processing files with ecmascript (for target os.windows.x86_64):
collections/recipes.js:25:1: Unexpected token, expected “,” (25:1)

Your application has errors. Waiting for file change.

The above error is generated after adding the SimpleSchema definition:

RecipeSchema = new SimpleSchema({
name: {
type: String,
label: “Name”
},
desc: {
type: String,
label: “Description”
},
author: {
type: String,
label: “Author”,
autoValue: function() {
return this.userID
},
createdAt: {
type: Date,
label: “Created At”,
autoValue: function() {
return new Date()
},
},
});

Recipes.attachSchema( RecipeSchema );

Line 25:1 seems to be referring to }); at the closing bracket or parentheses.

Examples given are the same as my code, so why is Meteor crashing the app?

Do I need to enforce ecma script 6 for the Collection2 / SimpleSchema package?

Do I need to install some other package or update?

Meteor and Aldeed:Collection2 and SimpleSchema were all re-installed.

I cannot find a problem with my code and have no clue where to look now after 2 days trying to get past this.


#2

You don’t have a closing bracket on your author field. A bit if indentation might help with spotting this.


#3

Also note you can format a code block in the forums by surrounding it with three backticks (```)


#4

Oh, indeed, and agree. Please excuse beginner bone-head here. Thank you very much!