-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
I'm submitting a...
- Regression
- Bug report
- Feature request
- Documentation issue or request (new chapter/page)
- Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
In docs of https://docs.nestjs.com/techniques/mongodb the population example is shown as the following:
@Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Owner' })
owner: Owner;
But actually this is not correct, instead in reality owner is of type ObjectId. Only when explicitly populating the query owner ist of type Owner.
In the example the definition of CreateCatDto is not shown but if the types are used everywhere then the compiler would complain because there is a mismatch: When creating a new Cat one need to add owner of type ObjectId and not of type Owner as the compile would demand. Also when querying for Cat one will get an ObjectId while the compile thinks it is Owner.
Expected behavior
Provide a better example / best practice of population. Mongoose docs: https://mongoosejs.com/docs/typescript/populate.html
MickL
Metadata
Metadata
Assignees
Labels
No labels