I am using Collection2 to define a User Schema with the following property:
//Schemas.User
tags: {
type: [Schemas.Tags],
optional: true
}
//...
Schemas.Tags = new SimpleSchema({
name: {
type: String
}
correct: {
type: Number,
optional: true
}
wrong: {
type: Number,
optional: true
}
});
}
How should I go about updating the User property to add Tag
objects if they do not already exist but simply increment either the correct
or wrong
property if a Tag
object with same name already exists in the Users.tags
array?
Thank you for your help. I am still getting to grips with the whole Collection2 thing. =)