![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
node
HJD2018
这个作者很懒,什么都没留下…
展开
-
sequelize 关联查询时,为关联表设置了别名,导致查询结果错误的问题。
在node项目中使用sequelize进行关联查询。报错:You have used the alias child in two separate associations. Aliased associations must have unique aliases.原创 2023-11-20 16:09:32 · 502 阅读 · 0 评论 -
Sequelize 返回数据时间格式化
我使用了Sequelize的timestamps模式,它会自动关联 updateAt 和 createAt字段,现在需要格式化createAt的数据。我们可以使用 Sequelize 提供的方法,例如 setDataValue。createdAt 现在只是一个只读属性的数据,直接修改数据是不行的。这里格式化工具是使用了node提供的utility插件。Sequelize 返回数据的时间格式与数据库不同。但是使用Sequelize查询数据返回的却是。在数据库中时间的数据类型是。原创 2023-11-16 17:27:46 · 388 阅读 · 1 评论