.eq is not filtering when value is undefined (a BUG maybe?)

I already created a solution something like this:

.eq("_id", orderId != undefined ? orderId : null)

And it’s working but my question is why .eq works like that it should not return when the value undefined it should throw error I guess.