In my case, I have two collections subject
, student
. In web application, a form will be submitted with selected studentID and subjectCode for enrollment. However, I got this error: Uncaught Error: After filtering out keys not in the schema, your modifier is now empty
.
If anyone could help me out here I would really appreciate it.
Thanks a lot.
The subject
schema is like this:
const subjectSchema = new SimpleSchema({
subjectCode:{
type: String,
label: “Subject Code”,
index:true,
unique:true
},
subjectName:{
type: String,
label: “Subject Name”,
index:true,
unique:true
},
enrollment:{
type: Array,
optional: true
},
‘enrollment.$’:String,
});
For action
Template.enroll.events({
‘submit form’:function(e){
e.preventDefault();
var name = (e.target).find('[name=studentID]').val(); var subjectCode = (e.target).find(’[name=subjectCode]’).val();subject.update( {subjectCode:subjectCode}, {$push:{"enrollment.$":name}});
}
});