gpt4 book ai didi

javascript - Meteor 如何调试允许/拒绝

转载 作者:行者123 更新时间:2023-12-03 08:46:39 28 4
gpt4 key购买 nike

我正在开发我的 meteor 项目,并开始设置我的第一个更复杂的允许/拒绝规则。我发现很难看出哪些允许触发,哪些不允许触发,以及这些函数中的某些变量包含什么。例如:

List.allow({
update: function(userId, docs, fields, modifier) {
if(!docs.user){
console.log("list without owner => updateable for everyone");
return true;
}
else if(userId === docs.user){
console.log("user is owner of list => updateable!");
return true;
}
else {
console.log("no access, is not owner");
return false;
}
}
});

console.log 语句不起作用(控制台中未记录任何内容)。我想知道在检查允许规则以调整我的代码时包含哪些文档、字段和修饰符。我如何在这些方法中进行调试?如果没有,有人可以纠正我的代码吗?我有一个集合,Meteor.users 可以有自己的记录,这应该只更新

最佳答案

使用meteor debug而不是meteor run来启动您的meteor应用程序。它将把 Node 检查器包添加到正在运行的 Meteor 应用程序中,以便您可以对其进行调试。

您还可以在 CLI 中使用 Meteor Shell

了解更多信息Josh Owen's blog

关于javascript - Meteor 如何调试允许/拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32862892/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com