null !== undefined leads to always overwriting client supplied _id with undefined for validated inserts, which led mongodb to create a new _id value for each such document.
Fixes #2097 - null !== undefined lead to always overwriting client su…
…pplied _id with undefined for validated inserts, which led mongodb to create a new _id for each such document.
See line 703 above to see how generatedId can be undefined. When generatedId === null in the caller, it is not pushed to the argument list, leading to undefined here.
generatedId === null
Wow, sorry, I can't believe I didn't catch this (I swore I had tests that should catch this!)
I think the intended patch is actually to the code that invokes this.
Follow-up to 4777e64: fix client-specified _id
This was a regression in 0.8.1 which caused client-specified `_id` to
always be ignored for collections with at least one allow/deny rule.
Fixes #2097. Fixes #2099.