Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
根据此处的建议,我添加了一个拒绝子句,但现在我的插入不再起作用。
todos.deny({ insert: function (userId, todo) { todo['creationDate'] = (new Date()).getTime(); return false; } })
没有否认,我的 todos 插入工作。到底是怎么回事?
一旦你设置了一个Meteor.Collection.deny子句(假设你已经删除了autopublish包),添加至少一个allow子句很重要——否则你的服务器代码将永远不会接受任何插入。
Meteor.Collection.deny
autopublish
allow
将此添加到您的代码中:
todos.allow({ insert: function (userId, todo) { return true; } })
您可能需要对updateandremove子句执行相同的操作。
update
remove