Say that I want to display a list of user purchases after they log in. I use autoform and simple-schema to create form elements. When a user signs up for the first time, an empty shopping list form is displayed. When you submit the form, the shopping list is saved in db.
I want to know how I can save this data for each user.
Normally I would do something like this:
ShoppingList.insert({ name: item_name, price: 0, createdBy: Meteor.userId() });
How would this be done using autoform and simple-schema? Is it possible to do something like this:
Schema.ShoppingList = new SimpleSchema({ item: { type: String, regEx: /^[a-zA-Z-]{2,25}$/ }, price: { type: Number, regEx: /^[0-9]{2,25}$/ }, createdBy: { type: String, value: Meteor.userId() } });
Thanks again:)
javascript meteor
user1532669
source share