【问题标题】:Autoform insert no restrictionsAutoform插入无限制
【发布时间】:2017-03-19 00:31:24
【问题描述】:

我正在尝试创建一个收集数据的公共自动表单。结果,使用表单的人没有 userId。如何创建没有限制的插入表单?

这是我以前使用过的,但它需要作为用户注册。

Collection.allow({
  insert: function(userId, doc) {
    return !!userId;
  },
});

【问题讨论】:

    标签: meteor meteor-autoform simple-schema meteor-collection2


    【解决方案1】:

    只要改成这样:

    Collection.allow({
      insert: true,
    });
    

    基本上它允许任何人将记录插入到您的数据库中。

    【讨论】:

    • 我不确定为什么您的解决方案不起作用,但是添加 insert: function(doc) { return true; } 使其起作用。谢谢米克尔。
    • 对不起,我的错,我确实想知道是否需要明确的回报:)
    • 一切都好。一看到它,便士掉了,所以再次感谢。
    猜你喜欢
    • 1970-01-01
    • 2016-06-15
    • 2015-09-21
    • 1970-01-01
    • 2015-02-01
    • 2019-01-12
    • 2018-01-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多