I'm searching through an sql database using knex.js query builder and I'm trying to create a model that searches for all rows where the title has the input title I pass.
async function getByTitle(title) {
const result = await db('recipes')
.select('*')
.whereRaw('LOWER(title) LIKE ?', title);
return result;
}
This seems to only give the exact matches to the title instead of pattern matching it. For example, I have
test
test1
test2
test3
when title is test, I expect to get all that back, but instead I only get test back. I've searched through many similar questions and this seemed to be the solution, but this isn't working in my case.