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; }); 

docs


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -