将架构附加到 Meteor.users
Attaching schema to Meteor.users
我正在尝试自定义我的Meteor.users模式:
Schema.users = new SimpleSchema({
username: {
type: String,
},
test:{
type: String,
},
services: {
type: Object,
optional: true,
blackbox: true
}
});
当我打电话给:
Accounts.createUser({username:"lionel",test:"123",password:"123"});
返回的控制台:
Exception while invoking method 'createUser' Error: Test is required
......
Sanitized and reported to the client as: Test is required [400]
我在这里错过了什么?
>Accounts.createUser()
希望在profile
键中遇到额外的信息。
用:
Accounts.createUser({username:"lionel",password:"123",profile: {test:"123"}});
并在服务器上设置Accounts.onCreateUser()
功能:
Accounts.onCreateUser(function(options, user) {
if (options.profile) user.test = options.profile.test;
return user;
});
文档
相关文章:
- Meteor如何接收HTTP请求
- Meteor-将选定窗体中的对象添加到集合中
- Meteor上的启动页面
- Meteor方法在客户端返回null,在客户端运行的相同方法返回正确的值
- Meteor-添加用户自定义字段的方法不起作用
- Meteor忘记了密码的实现
- 链接所有<a>Meteor
- 从客户端更新Meteor.users
- 子类化 Meteor.users() 以获得不同的用户类型
- 为什么 Meteor.users.findOne({用户名: “test”}) 返回一个对象,但用具有相同值的变量替换
- 将架构附加到 Meteor.users
- 如何启用帐户用户可编辑或如何删除或编辑Meteor.users()的用户
- 如何添加我自己的Meteor.users个人资料;使用aldeed自动成型和collection2
- 如何使用 Meteor.users.update 在特定案例对象中包含变量
- 为什么这段代码似乎没有向Meteor.users.profile对象添加记录?
- Meteor Users集合和Deps.自动运行的问题
- 向Meteor.users的配置文件部分添加字段
- 检查Meteor.users订阅是否已填充
- 后续:Meteor.users带有字符串参数
- Meteor,'/users/insert'已经定义