在meteor 中更新用户个人资料详细信息不起作用 [英] Updating user profile details in meteor not working
本文介绍了在meteor 中更新用户个人资料详细信息不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在我的流星应用程序中编辑用户集合中的用户详细信息.我的代码是
How can I edit the user details in users collection in my meteor app.My code is
Meteor.users.update({_id:this._id}, { $set:{"profile.name":pname}} )
这仅适用于列表中的第一个用户.如何为列出的所有用户执行此操作?
This is working only for the 1st user in the list. How can I do this for all users listed ?
推荐答案
我发现更新 Meteor 用户的唯一方法是使用带有 Meteor.userId()
的 _id 设置条件:
I found that the only way to update a Meteor user was to set the criteria using the _id with the Meteor.userId()
:
Meteor.users.update( { _id: Meteor.userId() }, { $set: { 'oauth.token': token }} );
我在服务器端执行此操作,因此它会阻止客户端,直到来自 Mongo 的成功/失败.
I do this on the server side so it will block the client until success/failure from Mongo.
这篇关于在meteor 中更新用户个人资料详细信息不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文