I'm trying to insert the logged in users username but whenever I submit the form. The collection never gets inserted. It only gets inserted if I comment out the createdBy field. I'm currently using the package User Accounts as my login/signin procedure
Here is my code:
createdBy: {
type: String,
autoValue: function() {
return this.field('username');
}
},
createdAt: {
type: Date,
autoValue: function() {
return new Date();
}
}
Never mind solved it here is what I had to put down. Hope it helps someone.
createdBy: {
type: String,
autoValue: function() {
return Meteor.user().username
}
},
createdAt: {
type: Date,
autoValue: function() {
return new Date();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With