如何获取已加入用户表中除一列之外的所有列。
我希望 password
属性/列不出现在 Promise 响应中。这是行不通的,因为我正在打电话
属性:{排除:['密码'] }
在
DBTweet
没有属性密码。连接的表DBUser
具有该功能。
这是我当前的代码。我正在使用 Sequelize ORM
DBTweet.findAll({ include: [DBUser, DBComment], attributes: { exclude: ['password'] }})
.then(tweets => {
res.status(200).json(tweets)
})
.catch(err => {
printC(err)
res.status(500).json({ error: err })
})
提前致谢
最佳答案
这是我的解决方案:
DBTweet.findAll({ include: [{ model: DBUser, attributes: { exclude: ['password'] } }, DBComment]})
关于javascript - MySQL连接表时出现: Get all columns except one,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56061984/