1

根据此处的建议,我添加了一个拒绝子句,但现在我的插入不再起作用。

todos.deny({
    insert: function (userId, todo) {
        todo['creationDate'] = (new Date()).getTime();
        return false;
    }
})

没有否认,我的 todos 插入工作。到底是怎么回事?

4

1 回答 1

0

一旦你设置了一个Meteor.Collection.deny子句(假设你已经删除了autopublish包),添加至少一个allow子句很重要——否则你的服务器代码将永远不会接受任何插入。

将此添加到您的代码中:

todos.allow({
    insert: function (userId, todo) {
        return true;
    }
})

您可能需要对updateandremove子句执行相同的操作。

于 2013-05-05T21:03:01.993 回答