Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS docs issues with PopulatedDocs and subdocs #10949

Closed
vkarpov15 opened this issue Nov 2, 2021 · 1 comment
Closed

TS docs issues with PopulatedDocs and subdocs #10949

vkarpov15 opened this issue Nov 2, 2021 · 1 comment
Labels
typescript Types or Types-test related issue / Pull Request
Milestone

Comments

@vkarpov15
Copy link
Collaborator

#10617 (comment)

@vkarpov15 vkarpov15 added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Nov 2, 2021
@vkarpov15 vkarpov15 added this to the 6.0.15 milestone Nov 2, 2021
@rongem
Copy link

rongem commented Nov 28, 2021

@vkarpov15: Thank you for your last comment, it provided the missing link. I was able to migrate to Mongoose 6 now.

To recap the missing parts in documentation:

While for the user document (interface) in Mongoose 5 string types as MongoIds worked, in Mongoose 6 you either have to use Types.ObjectId (if you don't want to populate) or PopulatedDoc<OtherUserDocument, Types.ObjectId> as type for your Ids.

In the Schema Definition, both variants have to be set as Schema.Types.ObjectId.

The difference between Schema.Types.ObjectId and Types.ObjectId should be explained somewhere, since it is not intuitive.

@vkarpov15 vkarpov15 added typescript Types or Types-test related issue / Pull Request and removed docs This issue is due to a mistake or omission in the mongoosejs.com documentation labels Nov 30, 2021
@vkarpov15 vkarpov15 modified the milestones: 6.0.16, 6.0.17 Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

No branches or pull requests

2 participants