I implemented a new SimpleSchema for my collection. Below is the definition and schema of the collection:
Upon calling this method from the client side:
export const setEventInvitationStatus = new ValidatedMethod({
name: 'events.updateParticipantStatus',
mixins: [LoggedInMixin],
checkLoggedInError: {
error: 'notLogged',
},
validate: new SimpleSchema({
eventId: { type: String },
inviteTo: { type: String },
newStatus: { type: String },
}).validator(),
run({ eventId, inviteTo, newStatus }) {
Events.update(
{ '_id': eventId, 'participants.userId': inviteTo },
{
$set: { 'participants.$.inviteStatus': newStatus },
});
},
});
However, I encountered an error:
Exception while invoking method 'events.updateParticipantStatus' { stack: 'Error: After filtering out keys not in the schema, your modifier is now empty\n at [object Object].doValidate (packages/aldeed_collection2-core/lib/collection2.js:374:1)\n at [object Object].Mongo.Collection.(anonymous function) [as update] (packages/aldeed_collection2-core/lib/collection2.js:173:1)\n at [object Object].run (imports/api/events/server/methods.js:101:10)\n at [object Object].LoggedInMixin.methodOptions.run (packages/tunifight:loggedin-mixin/loggedin-mixin.js:28:16)\n at ValidatedMethod._execute (packages/mdg:validated-method/validated-method.js:93:12)\n at [object Object].ValidatedMethod.connection.methods._connection$methods.(anonymous function) (packages/mdg:validated-method/validated-method.js:54:23)\n at [object Object].methodMap.(anonymous function) (packages/meteorhacks_kadira/lib/hijack/wrap_session.js:164:1)\n at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)\n at packages/ddp-server/livedata_server.js:711:19\n at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)',
What did I do wrong?