Support querying null value
evilchis94 opened this issue · 3 comments
evilchis94 commented
Steps to reproduce
I want to filter records where the column value is MySQL NULL type.
service('myservice').find({ query: { column: null } })
Expected behavior
Return all records where value is MySQL NULL type ( query.whereNull(column) )
Actual behavior
Returns nothing because knexify function is doing query.where(column, 'null')
daffl commented
null
queries should be supported but if the query is coming in through REST, which only allows strings, you will have to convert the string 'null'
to the actual null
value in a before hook.
It will work through a Socket.io connection without having to convert.
evilchis94 commented
I didn't notice. My fault. Tested with socket.io connection and worked! Thank you!
carcinocron commented
similar to $bt
, $and
, $or
, $in
, what about adding an { "$null": true }
?