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

Update mongodb driver to 4.3.1 #11246

Closed
wants to merge 1 commit into from

Conversation

lorand-horvath
Copy link
Contributor

No description provided.

@vkarpov15
Copy link
Collaborator

Looks like it'll be a bit harder for us to upgrade to 4.3.1: it looks like findOne() now adds & { _id: any }, so we'll have to figure out a workaround.

@lorand-horvath
Copy link
Contributor Author

Looks like it'll be a bit harder for us to upgrade to 4.3.1: it looks like findOne() now adds & { _id: any }, so we'll have to figure out a workaround.

Is there any documentation on this?

vkarpov15 added a commit that referenced this pull request Jan 27, 2022
@vkarpov15
Copy link
Collaborator

@lorand-horvath not to my knowledge.

We did some digging and the issue was introduced in mongodb/node-mongodb-native#3102 . Long story short, the MongoDB Node driver's WithId<> type is slightly incompatible with Mongoose's Require_id<> type. In theory, these two types should be exactly equivalent: return the generic type param, but with a required _id property. In practice, TypeScript thinks they're different.

We solved this issue, for now, by pulling in the ModifyResult type in e0ed2e8 . Trying to replace Mongoose's Require_id<> type caused some issues with our TypeScript maps tests, among others, so this seems like the simplest and cleanest way to work around this issue.

@vkarpov15 vkarpov15 closed this Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants