-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.8.0
-
Component/s: TypeScript
What problem are you facing?
It's great with Type support for updates, but it comes with at least two regressions breaking a lot of our codebase. I'm omitting _id when creating the collection type (see screenshots) - as I believe was the recommendation before.
- _id is not allowed in neither $set or $setOnInsert. It is still allowed for queries, so I'm pretty sure it's not an error in our types.
- Setting sub-documents doesn't seem to be work either.
This gives a lot of errors - especially since type errors on the queries/updates somehow breaks the entire type resolve chain (any subsequent code won't even recognise it's dealing with a promise anymore).
What driver and relevant dependency versions are you using?
Node.js Mongo Driver 4.8 and TypeScript 4.7.4
Steps to reproduce?
Set up the types as per the screenshots.
- depends on
-
NODE-4424 Investigate NODE-4423 - Type Regressions in 4.8
- Closed
- is caused by
-
NODE-4267 Better typing for UpdateFilter to support nested fields
- Closed
- is duplicated by
-
NODE-4450 Better typings for updating / querying nested objects
- Closed
- is related to
-
NODE-4432 Investigate improving $set and $setOnInsert type information or documentation
- Backlog