目的是将例如 2 欧元从 user1 转移到 user2
模型/myComponents.js
Meteor.users.allow({
update: function (userId) {
//check if an user is connected
if(userId == null){
return false;
}else{
return true;
}
},
remove: function () {
return false;
}
});
客户端/myComponents.js
...
this.chooseWinner = (subject,comment) => {
...
// this works
Meteor.users.update({_id: comment.user_id}, {$set:{credit : winCash}});
...
在谷歌浏览器终端中,我可以这样做:
Meteor.userId();
I obtain something like : "HTjgBTBcBk4npQSBe"
在谷歌浏览器终端之后,我可以这样做:
Meteor.users.update({_id: "HTjgBTBcBk4npQSBe"}, {$set:{credit : 12.34}});
!!!! Then the credit of this user is modified !!!!!
我怎样才能在 client/myComponent.js 中更新,而不是在谷歌控制台中更新???
谢谢