findOneAndUpdate
typing does not include null result
#10820
Labels
typescript
Types or Types-test related issue / Pull Request
Milestone
This issue occurred when updating from 6.0.5 to 6.0.8
The behaviour before was that
findOneAndUpdate
would either return the new/old document (depending on the options) or null, when no document was updated.With this commit the typing of the function was changed to not include null anymore.
However, it is still possible to receive a
null
value, regardless of the typing. Steps to reproduce:findOneAndUpdate
on an empty repository (any data or model will do)My proposition would be to add the null value back to the typing or throw a matching error.
Versions used:
The text was updated successfully, but these errors were encountered: