gpt4 book ai didi

javascript - Sails js 未声明的变量 : NaN when modelling associations

转载 作者:行者123 更新时间:2023-11-30 22:56:20 26 4
gpt4 key购买 nike

我在 Sails 中有两个模型 - Users 和 Absences。用户有很多缺席记录,所以我正在尝试建立一对多关联。它们看起来像这样:

用户.js在属性中:

id: {
type: 'integer',
unique: true,
primaryKey: true,
columnName: 'idx'
},
absences: {
collection: 'absence',
via: 'idxuser'
}

缺席.js在属性中:

id: {
type: 'integer',
unique: true,
primaryKey: true,
columnName: 'idx'
},
idxuser: {
model: 'user'
}

但是当我调用用户记录时,我得到这个错误:

Error (E_UNKNOWN) :: Encountered an unexpected error
ER_SP_UNDECLARED_VAR: Undeclared variable: NaN

并且堆栈跟踪引用了 sails-mysql 模块。

我正在使用:风 sails 0.10.5 sails -mysql 0.10.6 Node 0.10.25

最佳答案

我也遇到了这个异常。但是,DB 在列中有空值。该类型的属性是“整数”。首先检查您在数据库中的值。

关于javascript - Sails js 未声明的变量 : NaN when modelling associations,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26213503/

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