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

Fix ts types for query set #10942

Merged
merged 2 commits into from
Nov 2, 2021
Merged

Conversation

jneal-afs
Copy link
Contributor

Summary

The Query set method does not function properly in TypeScript projects. It currently only supports, the string, value implementation, but not the object only implementation. See https://github.com/Automattic/mongoose/blob/5.x/lib/query.js#L1835-L1848 for reference.

Examples

// Does not work
Model.updateOne({ id }).set({ name: 'new' });

// Works
Model.updateOne({ id }).set('name', 'new');

@jneal-afs
Copy link
Contributor Author

I should note, my project uses 5.x and that is why I opened this PR on the 5.x branch. However, this issue is also present in the master branch, so it should be cherry-picked there as well.

@vkarpov15 vkarpov15 added this to the 5.13.13 milestone Nov 2, 2021
@vkarpov15 vkarpov15 merged commit 4d12a62 into Automattic:5.x Nov 2, 2021
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