I'm trying to customise my Meteor.users schema:
Schema.users = new SimpleSchema({
username: {
type: String,
},
test:{
type: String,
},
services: {
type: Object,
optional: true,
blackbox: true
}
});
And when I call:
Accounts.createUser({username:"lionel",test:"123",password:"123"});
Console returned:
Exception while invoking method 'createUser' Error: Test is required
......
Sanitized and reported to the client as: Test is required [400]
What am i missing here?
Accounts.createUser()
expects extra info to come across in a profile
key.
Use:
Accounts.createUser({username:"lionel",password:"123",profile: {test:"123"}});
And set up an Accounts.onCreateUser()
function on the server:
Accounts.onCreateUser(function(options, user) {
if (options.profile) user.test = options.profile.test;
return user;
});