I am trying to compare if a record exists on a particular date (year, month) using Sequelize for a specific employee. However, I am having difficulty comparing multiple attributes. The code below is the query I tried but failed.
const exist = await Attendance.findAll({
where: {
$and: [
sequelize.where(sequelize.fn('YEAR',sequelize.col('currentDate')), 2021),
sequelize.where(sequelize.fn('MONTH',sequelize.col('currentDate')), 9),
{employeeId: 1}
]
}
});