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,当我尝试在未经身份验证的情况下插入到集合时,我遇到访问被拒绝错误,以下是我的权限: 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

在使用对象文本时,键可以显式地写为字符串。