TypeError: Cannot set property '_id' of undefined #6093 - GitHub
This is a bug in mongoose, the fix will be in 5.0.5. This only affects queries where you're querying by _id: undefined, which is admittedly a pretty strange thing to do since you can't store undefined in mongodb from node because it just gets converted to null, but these queries will work as they did in 4.x starting in 5.0.5.