javascript - Attaching schema to Meteor.users -
i'm trying customise meteor.users schema:
schema.users = new simpleschema({ username: { type: string, }, test:{ type: string, }, services: { type: object, optional: true, blackbox: true } });
and when call:
accounts.createuser({username:"lionel",test:"123",password:"123"});
console returned:
exception while invoking method 'createuser' error: test required ...... sanitized , reported client as: test required [400]
what missing here?
accounts.createuser()
expects info come across in profile
key.
use:
accounts.createuser({username:"lionel",password:"123",profile: {test:"123"}});
and set accounts.oncreateuser()
function on server:
accounts.oncreateuser(function(options, user) { if (options.profile) user.test = options.profile.test; return user; });
Comments
Post a Comment