, // 是否主键
autoIncrement: true, // 是否自增
comment: "id", // 备注
},
},
{...({
order: [
['type', 'DESC'],
['id', 'ASC'],
],
});
优先满足按 type 降序,如果 type 一样, 那么按 id 升序。...// 一个搜索框搜索多个字段
[Op.or]: {
phone: {
[op.like]: `%${search}%`,
},
name: {...,
required: true // 表示该 comment 数据是否必须,如果为空那么整个person对象都不返回
},
],
});
这里涉及的是数据库的一些概念,left-join...],
});
而是限制返回的数据 所有 person 的 comment 的总数量,开整
await person.findAll({
limit: 5,
// 加了这个false之后,limit