我不断收到此错误。
The primary key is set to `id`, but no such attribute was found on the model.
我在数据库中的表不使用任何主键,并且没有关于如何在 sails 中禁用主键属性的教程。
有没有办法让我在不指定 id 属性或主键的情况下查询模型?
最佳答案
您的模型中需要有某种主键。 sails 文档建议的方法是仍然使用“id”属性,但给它一个自定义的columnName。例如在模型中:
id: {
type: 'number',
columnName: 'employeeID',
required: true
{
关于node.js - 风 sails JS : How to disable primary key attribute?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51966645/