Filter by unset
It would be nice if there were a way to filter by a field whose value is "unset". Given that I can now use
db.patch
to unset a field's value by passing in undefined
(e.g. db.patch(id, { tag: undefined })
, per the docs)—which is really nice!—I also expected something like
to work, but it doesn't!
3 Replies
Actually, it's occurring to me that perhaps I'm not using
q.not
correctly!q.neq(q.field("tag"), undefined)
should work 🙂
Or if you prefer, q.not(q.eq(q.field("tag"), undefined))
I didn't realize that there was a
q.neq
! I used q.not(q.eq(...))
and that worked. Thank you @lee!