0
新しいユーザーをMeteor.users()
に挿入するボタンがあります。Meteor.users()に新しいフィールドを追加するにはどうすればいいですか?
私はこの方法で持っているサーバーの場合:
Meteor.methods({
'addUser': function(user) {
return Accounts.createUser(user)
}
})
とクライアントで(ボタンをクリックした後):
上記のコードを使用してvar newUser = {
email: t.find('#email').value,
password: t.find('#pwd').value,
profile: { name: t.find('#name').value, group: t.find('#userType').value },
roles: checkedRoles // I can successfully console.log(checkedRoles) which is an array of strings.
}
Meteor.call('addUser', newUser, function(error){
if(error){
sweetAlert(error)
} else {
sweetAlert('User Successfully Added')
}
})
を、ユーザーが追加されますが、roles
なしフィールド。
私の質問は、新しく追加されたユーザーにroles
フィールドを追加するにはどうすればいいですか?
あなたはAlanningを試してみました。その後、
meteor add alanning:roles
(サーバーサイド方式で)
? – Orozcorpこれはhttps://stackoverflow.com/questions/43436117/how-to-read-the-roles-array-from-users-collectionの複製であると思われます – ghybs
@Orozcorpはい、私はalnning:rolesパッケージを使用しています – sourceplaze