I'm using the orm package in node.js and I'm trying to query the database using find()
on one of my models. However, I can't figure out how to check a column for NULL values using find()
. Is there a way to do this?
If the sent_at field is not there when its not set then:
db.emails.find({sent_at: {$exists: false}})
If its there and null, or not there at all:
db.emails.find({sent_at: null})
Reference: Query for nul fields
Note: Since you didn't mention the database name nor the orm which you used assuming the database as mongodb.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With