私はMeteorをビデオチュートリアルを通して学び、コードを完成させても同じ結果を得られませんでした。コードは次のとおりです。Meteorのユーザーアカウント:core role empty
Meteor.startup(function(){
if(Meteor.users.find().count() < 1){
var users= [
{
name: "Superuser",
email: "[email protected]",
roles: ['admin']
}
];
_.each(users, function(user){
var id;
id = Accounts.createUser({
email: user.email,
password: "password",
profile:{
name: user.name
}
});
if(user.roles.length > 0){
Roles.addUsersToRoles(id, user.roles);
}
});
}
});
Meteor.roles.find。()。fetch()コンソールが表示されるものとします。オブジェクト名: 'admin' _id。 'なんでも';しかし、私は空を飛ばす[]。
私はalanningを使用しています:役割atmospherejsから事前に
感謝を。
これはサーバー側で実行してもよろしいですか?あなたはMongoデータベースの新しいユーザーを見ていますか? – aedm
はい、サーバー側にあり、mongoのdb.roles.find()は空に見えます。 :/ – julio