ユーザーのプロファイル情報が表示されません。理由はありますか?
サーバー:
Meteor.publish("userData", function () {
return Meteor.users.find({_id: this.userId},
{fields: {'profile': 1}});
});
Meteor.publish("allUsers", function () {
//TODO: For testing only, remove this
return Meteor.users.find({}, {fields: {'profile': 1}});
});
クライアント :
Meteor.autosubscribe(function () {
Meteor.subscribe('allUsers',null , function() { console.log(Meteor.users.find().fetch()) });
Meteor.subscribe('userData', null, function() { console.log(Meteor.user())});
});
....
Accounts.createUser({email:email,password:password, profile: {name: name}},function(error){
...
});
私のコンソールは、最初のものは_idとメールのみ、2番目のものは未定義のオブジェクトを出力しました。私のserver.jsには正常に機能する名前検証があるため、プロファイル情報(私の場合は名前)が機能しているようです:
Accounts.onCreateUser(function(options, user) {
if(options.profile.name.length<2)
throw new Meteor.Error(403, "Please provide a name.");
return user;
});
何か不足していますか?
ありがとう!