You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I'm submitting a...
Current behavior
In docs of https://docs.nestjs.com/techniques/mongodb the population example is shown as the following:
But actually this is not correct, instead in reality
owner
is of typeObjectId
. Only when explicitly populating the queryowner
ist of typeOwner
.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 newCat
one need to addowner
of typeObjectId
and not of typeOwner
as the compile would demand. Also when querying forCat
one will get anObjectId
while the compile thinks it isOwner
.Expected behavior
Provide a better example / best practice of population. Mongoose docs: https://mongoosejs.com/docs/typescript/populate.html
The text was updated successfully, but these errors were encountered: