Sorry for my english. I use the package useraccounts:bootstrap for login, registration and so on. How can I add arbitrary data to Meteor.users collection after registration. For example, I want, that users after registration had a field 'status' with a value of 'false' or the field 'time' with time of registration. Thank you.
If the user needs to supply the data, you will need to customize the UI and add the desired fields.
On the server, you can attach an onCreateUser()
callback to set the data when a new user is created.
import _ from 'lodash';
Accounts.onCreateUser((options, user) => {
// add your extra fields here; don't forget to validate the options, if needed
_.extend(user, {
status: false,
createdAt: new Date()
});
return user;
});
the options
argument contains the data from the client side.