Can someone please help me understand why the tags
field is invalid?
var Schemas = {};
Schemas.Questions = new SimpleSchema({
text: {
type: String,
label: "Text"
},
choices: {
type: [String],
label: "Choices",
minCount: 4,
maxCount: 4
},
correctChoice: {
type: Number,
label: "Correct Choice",
min: 0,
max: 3
},
tags: {
type: [Schemas.Tags],
label: "Tags",
minCount: 1,
autoForm: {
options: function() {
return Tags.find().map(function(t){
return {label: t.name, value: t._id};
});
}
}
},
statistics: {
type: Schemas.QuestionStatistics,
label: "Statistics",
optional: true
}
});
Schemas.Tags = new SimpleSchema({
name: {
type: String,
label: "Tag Name"
},
correct: {
type: Number,
label: "Correct",
min: 0,
autoValue: Schemas.zeroOrInc
},
wrong: {
type: Number,
label: "Wrong",
min: 0,
autoValue: Schemas.zeroOrInc
}
});
The Tags
collection is defined and I have a fixtures files that loads some example Tags into the collection. The console says the error is at the line that says
Schemas.Questions = new SimpleSchema({
Thank you so much for reading and helping. Sorry if this is a noob question.