loopback-next
loopback-next copied to clipboard
[@loopback/sequelize] Attempting to use `options` in a `where` filter leads to "There is no equivalent operator" exception
Describe the bug
This section of the code throws an exception if the "where" filter includes an "options" key: https://github.com/loopbackio/loopback-next/blob/96b9a56788937f081e61f1d48dc080c7233d394c/extensions/sequelize/src/sequelize/sequelize.repository.base.ts#L604
Example filter that will throw an exception:
where: {
name: {
like: '%abcdefg%',
options: 'i'
}
}
References:
- https://loopback.io/doc/en/lb4/Where-filter.html#operators
Logs
No response
Additional information
No response
Reproduction
N/A
@loopback/sequelize
is meant to be used with SQL dialects, this option being only supported by LoopBack in its memory and MongoDB connectors is not expected to work correctly.
Please use ilike
or regexp
operator instead depending on your needs.
@shubhamp-sf That’s true but the existing connector doesn’t throw an exception even if it is unused by the underlying MySQL connector. I was thinking for backwards compatibility / migration purposes it might be helpful if it was a no-op.