Given that I have a model called Model with a column called items which holds an array of strings, how can I query to see whether a string queryString is in the array or has a similar element in the array?
Example:
items: ["cat", "dog", "bird", "turtle", "doe" ]
queryString = ["%do%","%b"]
Should return:
animalArray = ["dog", "doe", "bird"]
Edit: Is there anyway to pair up an $overlap with $iLike somehow?
Model.findAll({
where: {
items: { $in: { $iLike: { $any: queryString } } }
}
}).then(function(array){
// Do whatever here with array
})
$iLike is a special Postgres thing in Sequelize
Thanks!