[SOLVED] Calling Accounts.createUser() on schema defined for Meteor.users()


#1

I want to setup a schema for the Meteor.users collection, which I’ve done with the given example from Aldeed’s SimpleSchema. The problem I’m having now is calling Accounts.createUser() as this gives me a very vague Meteor 500 Internal Server Error. What am I doing wrong? Am I even supposed to be using Accounts.createUser() if I’m defining my own schema? Eg. should I be handling this myself instead? Or is there some way of getting these two things to work together?


#2

What is the Meteor 500 Internal Server Error you are getting.
Trying setting optional: true for the user schema fields.


#3
Error
details: undefined
error: 500
errorType: "Meteor.Error"
message: "Internal server error [500]"
reason: "Internal server error"
stack: "errorClass@http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:532:24↵_livedata_result@http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:4964:39↵onMessage@http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:3725:28↵http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:2717:19↵forEach@[native code]↵forEach@http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:156:18↵onmessage@http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:2716:15↵dispatchEvent@http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:156:27↵_dispatchMessage@http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:1141:23↵_didMessage@http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:1199:34↵onmessage@http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:1346:28"
__proto__: Object

#4

Figured this out. In the standard schema defined as an example for Collection2 + Simple Schema for Meteor.users there is a username field:

username: {
    type: String,
    regEx: /^[a-z0-9A-Z_]{3,15}$/
},

That was causing the trouble as by default the Meteor.users collection defines username as part of profile: {}