Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在meteor中更新用户配置文件详细信息无效_Meteor - Fatal编程技术网

在meteor中更新用户配置文件详细信息无效

在meteor中更新用户配置文件详细信息无效,meteor,Meteor,如何在meteor应用程序的用户集合中编辑用户详细信息。我的代码是 Meteor.users.update({_id:this._id}, { $set:{"profile.name":pname}} ) 这仅适用于列表中的第一个用户。如何为列出的所有用户执行此操作?根据,将“multi”选项设置为“true”: 我发现更新Meteor用户的唯一方法是使用带有Meteor.userId()的_id设置标准: 我在服务器端执行此操作,因此它将阻止客户端,直到Mongo成功/失败。问题在于您引用

如何在meteor应用程序的用户集合中编辑用户详细信息。我的代码是

 Meteor.users.update({_id:this._id}, { $set:{"profile.name":pname}} )
这仅适用于列表中的第一个用户。如何为列出的所有用户执行此操作?

根据,将“multi”选项设置为“true”:


我发现更新Meteor用户的唯一方法是使用带有
Meteor.userId()的_id设置标准:


我在服务器端执行此操作,因此它将阻止客户端,直到Mongo成功/失败。

问题在于您引用的是不存在的内容

替换:


Meteor.users.update({u id:this.{u id},{$set:{“profile.name”:pname}})

作者:

Meteor.users.update({u id:this.userId},{$set:{“profile.name”:pname})

或者按照@occasl之前的建议使用Meteor.userId()


刚刚发生在我身上

当你这样写的时候,列表上应该只有一个用户-
\u id
对于不同的对象应该是不同的。你的“this.\u id”可能不是你想象的那样。检查您的UI是否正确更改了“this”。虽然语法正确,但users集合不能包含多个共享同一id的用户文档。如果是这种情况,则需要注意一些更糟糕的问题。
Meteor.users.update({_id:this._id}, { $set:{"profile.name":pname}}, {multi: true} )
Meteor.users.update( { _id: Meteor.userId() }, { $set: { 'oauth.token': token }} );