I have a posts model that I have published and is working fine. However, I have added the following field via simpleSchemas plugin:
userEmail: {
type: String,
autoValue: function() {
if (this.isInsert) {
return Meteor.user().email;
} else if (this.isUpsert) {
return {$setOnInsert: Meteor.user().email};
} else {
this.unset();
}
}
}
When I have this enabled, submit forms don't work, but don't raise any errors. Am I perhaps calling on Meteor.user().email
incorrectly? How do I associate the userEmail field with the email of the user who created the post?
The correct syntaxis is.
Meteor.user().emails[0].address