节点.js未捕获的异常类型错误:无法设置未定义的预处理 ''

Node.js uncaught exception typeError: cannot set preoprty '' of undefined

本文关键字:设置 预处理 未定义 错误 js 异常 节点 类型      更新时间:2023-09-26

我正在尝试更新模型中的数组。 但是,抛出上述错误。 不知道为什么。 使用计划是在尝试更新之前定义的。

customer.usagePlan.toolUsage.tools.push(aNewToolObject);
customer.updateAttribute('usagePlan',customer.usagePlan,function(err,something)    {
    //exception is thrown here
});

错误:

uncaught Exceptions: TypeError: Cannot set property 'usagePlan' of undefined

可在此处找到更新属性的文档:

http://apidocs.strongloop.com/loopback/#persistedmodel-prototype-updateattribute

updateAttribute 的代码是什么?

您确定第二个参数是属性本身,而不是对象,例如:

customer.updateAttribute('usagePlan',customer,function(err,something)