This is how my SimpleSchema validation looks like:
validate: new SimpleSchema({
type: { type: String, allowedValues: ['start', 'stop'] },
_id : { type: SimpleSchema.RegEx.Id, optional: true },
item: { type: String, optional: true }
}).validator()
But it is not exactly what I am needing:
If type
is start, there must be a item
value and if type
is stop there must be an _id
value.