SailsJS:如何禁用主键属性?
SailsJS: How to disable primary key attribute?
我一直收到这个错误。
The primary key is set to `id`, but no such attribute was found on the model.
我的table在数据库中没有使用任何主键,也没有关于如何在sails中禁用主键属性的教程。
有没有办法在不指定 id 属性或主键的情况下查询模型?
您的模型中需要有某种主键。 sails 文档推荐的方法是仍然使用 'id' 属性,但给它一个自定义的 columnName。例如在模型中:
id: {
type: 'number',
columnName: 'employeeID',
required: true
{
我一直收到这个错误。
The primary key is set to `id`, but no such attribute was found on the model.
我的table在数据库中没有使用任何主键,也没有关于如何在sails中禁用主键属性的教程。
有没有办法在不指定 id 属性或主键的情况下查询模型?
您的模型中需要有某种主键。 sails 文档推荐的方法是仍然使用 'id' 属性,但给它一个自定义的 columnName。例如在模型中:
id: {
type: 'number',
columnName: 'employeeID',
required: true
{