Reputation: 2386
As per title. I have found some questions roughly regarding the topic, but either proposed solutions do not work for me (error is thrown or generated query is missing conditions) or are clearly wrong, eg. suggesting that $eq
operator is case sensitive - it is definitely not.
How do I modify this query to make it case sensitive?
models.Item.findOne({
where: {
name: 'soughtString'
}
});
Upvotes: 1
Views: 163
Reputation: 22813
You can try to combine eq
with SHA1
function like this:
models.Item.findOne({
where: {
[Op.and]: [{
name: 'soughtString',
},
sequelize.where(
sequelize.fn('SHA1', sequelize.col('name')),
'=',
sequelize.fn('SHA1', 'soughtString')
)
]
});
This should be like a SQL condition like this:
where name = 'soughtString' and SHA1(name)= SHA1('soughtString')
Upvotes: 1