Meteor 匿名插入集合时拒绝访问
当我尝试在未经身份验证的情况下插入到集合时,我遇到访问被拒绝错误,以下是我的权限:Meteor 匿名插入集合时拒绝访问,meteor,Meteor,当我尝试在未经身份验证的情况下插入到集合时,我遇到访问被拒绝错误,以下是我的权限: signedforms.allow({ 'insert': function(userId, doc) { return userId; }, 'update': function(userId, doc, fields, modifier) { return userId; }, 'remove': function(userId, doc) { return us
signedforms.allow({
'insert': function(userId, doc) {
return userId;
},
'update': function(userId, doc, fields, modifier) {
return userId;
},
'remove': function(userId, doc) {
return userId;
}
});
在方法上尝试不带“”的操作,并返回true而不是id:
signedforms.allow({
insert: function(userId, doc) {
return true;
}
有关更多信息,请参阅本文如果您未通过身份验证,则没有
用户ID
,因此您的函数返回未定义的
。只需返回true
。在使用对象文本时,键可以显式地写为字符串。