Mongoose 6.4.X breaks PopulatedDoc parent-child relation typing, circular reference itself, works with 6.3.9. #12136
Labels
typescript
Types or Types-test related issue / Pull Request
Milestone
Prerequisites
Mongoose version
6.4.9
Node.js version
16.15.1
MongoDB server version
5.0.3
Description
After upgrading from 6.3.9 to 6.4.6 my schemas are broken.
I am using Nest Framework, but it's only decorators (see snippet below).
I tried to use the documentation but the documentation code is broken.
https://mongoosejs.com/docs/typescript/populate.html#using-populateddoc
ObjectId comes from nowhere, so the code can't run since ObjectId does not exist.
I tried everything I could without knowing what do to.
At the moment I downgraded to 6.3.9 and it works.
I am using TypeScript 4.7.4.
Steps to Reproduce
Expected Behavior
I expect the code to run just fine.
There are lot of reason to use bi-directional relation in order.
I don't expect parent.child and child.parent to be populated at the same time anyway.
The text was updated successfully, but these errors were encountered: