I have a photo attribute in one of my Sequelize models. I have a getter for it.
photo: {
type: Sequelize.STRING,
get: function () {
if (this.getDataValue("photo"))
return process.env.IMAGE_PREFIX + this.getDataValue("photo")
else
return this.getDataValue("photo")
}
},
but when i want to findall records in this model with ({raw:true}) getter doesn't work.
const categories = await Category.findAll({
limit: parseInt(limit),
offset: parseInt(offset),
raw: true,
where: {
title: { [Op.like]: '%' + searchString + '%' }
}
});
if i use ({plain:true}) instead , just finds one record.