I am having below modal
Job = new Mongo.Collection("job");
Job.attachSchema(new SimpleSchema({
jobId : {
type : String,
regEx: SimpleSchema.RegEx.Id,
optional: true,
autoValue : function(){
if (this.isInsert) {
return {$inc: 1};
}else{
this.unset();
}
},
autoform : {
omit : true
}
},
summary : {
type : String,
label : "Summary",
max : 200
},
orgId : {
type : String,
regEx: SimpleSchema.RegEx.Id,
autoValue : function(){
if (this.isInsert) {
return Meteor.user().profile.orgId;
}
},
autoform : {
omit : true
}
}
}));
i try to insert record with this model
jobCreateMethod : function(job){
job._id = Job.insert(job);
return job;
}
on adding jobId field having $inc to the model i am getting below error
Uncaught Error: When the validation object contains mongo operators, you must set the modifier option to true