在sequelize where条件中使用postgres日期函数

时间:2017-12-08 04:29:18

标签: node.js sequelize.js

我需要使用postgres日期函数在sequelize中应用where条件。以下是查询

    where created_at between date_trunc('month', current_date) and date_trunc('month',
current_date)+'1month'

我试过这个

    where:{user_id:user_id,created_at:{ [Op.between]: [[db.sequelize.literal('date_trunc(month, current_date)'),'test'],
[db.sequelize.literal('date_trunc(month, current_date)+1month'),'curr']]}}

如何通过提前使用sequelize ORM.Thanks来实现这一目标

0 个答案:

没有答案
相关问题