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

types: make _id required on Document type #14735

Merged
merged 1 commit into from
Jul 10, 2024
Merged

types: make _id required on Document type #14735

merged 1 commit into from
Jul 10, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #14660

Summary

_id: T is more correct because _id should always exist on a hydrated document by default. And this doesn't break any tests other than ones that assert on the behavior from #14660. @hasezoey what do you think, does this work fine with Typegoose?

Examples

@vkarpov15 vkarpov15 added this to the 8.6 milestone Jul 9, 2024
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works in typegoose, likely because typegoose already always did a mongoose.Document & mongoose.RequireId for typegoose's DocumentType (though it could not be removed because of the inference of _id as ObjectId if not explicitly defined)

@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Jul 10, 2024
@vkarpov15 vkarpov15 changed the base branch from master to 8.6 July 10, 2024 15:48
@vkarpov15 vkarpov15 merged commit b8f0109 into 8.6 Jul 10, 2024
5 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-14660 branch July 10, 2024 15:55
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

Successfully merging this pull request may close these issues.

TS: _id not required on DocumentArray properties of documents returned from query
2 participants