Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support querying null value #149

Closed
evilchis94 opened this issue Mar 22, 2018 · 3 comments
Closed

Support querying null value #149

evilchis94 opened this issue Mar 22, 2018 · 3 comments

Comments

@evilchis94
Copy link

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
Copy link
Member

daffl commented Mar 22, 2018

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
Copy link
Author

I didn't notice. My fault. Tested with socket.io connection and worked! Thank you!

@carcinocron
Copy link

similar to $bt, $and, $or, $in, what about adding an { "$null": true }?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants