Javascript 使用Meteor.users.find()获取profile.name
我可以使用以下方法获取普通字段,如Javascript 使用Meteor.users.find()获取profile.name,javascript,mongodb,meteor,Javascript,Mongodb,Meteor,我可以使用以下方法获取普通字段,如\u id和用户名: users: function () { return Meteor.users.find({}, {fields:{_id:1,username:1}}); } 但是如何从Facebook/Google/Twitter获取个人资料.name?使用hook编写个人资料.name Accounts.onCreateUser(function(options, user) { // We still want the de
\u id
和用户名
:
users: function () {
return Meteor.users.find({}, {fields:{_id:1,username:1}});
}
但是如何从Facebook/Google/Twitter获取个人资料.name
?使用hook编写个人资料.name
Accounts.onCreateUser(function(options, user) {
// We still want the default hook's 'profile' behavior.
if (options.profile) {
user.profile = options.profile;
user.profile.memberSince = new Date();
// Copy data from Facebook to user object
user.profile.facebookId = user.services.facebook.id;
user.profile.firstName = user.services.facebook.first_name;
user.profile.email = user.services.facebook.email;
user.profile.link = user.services.facebook.link;
}
return user;
});
但在创建新用户时会调用它,而不是我要求的。我知道如何使用Meteor.user().profile.name来获取名称,但这只给出了当前用户的名称,所以我想知道该字段名为calledOkay。现在我明白了,您的意思是,通过检查第二个链接。但是,
profile.name
已设置,因此无需自行添加