Navigation Menu

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(model): make exists(...) return lean document with _id or null instead of boolean #11142

Merged
merged 9 commits into from Dec 30, 2021

Conversation

AbdelrahmanHafez
Copy link
Collaborator

re #11138

@IslandRhythms IslandRhythms linked an issue Dec 27, 2021 that may be closed by this pull request
@Uzlopak
Copy link
Collaborator

Uzlopak commented Dec 28, 2021

This will definitely be a breaking change. I know a codebase where exists is checked to be a resolved boolean.

@AbdelrahmanHafez
Copy link
Collaborator Author

@Uzlopak
It is a breaking change that was supposed to land on mongoose v6.0, it didn't land due to a bug, but it was mentioned in the changelog, and people would be expected to change their code accordingly.

@vkarpov15 What do you think is the best action here? I think we can ship it in a minor release and make a note about it.

@vkarpov15 vkarpov15 changed the base branch from master to 6.2 December 30, 2021 22:09
@vkarpov15
Copy link
Collaborator

I'll merge this into the 6.2 branch in the interest of caution. This is a messy case where the docs say one thing, the TypeScript bindings say something else, and the actual behavior is inconsistent between the two. So let's put this in a minor release to minimize risk, but also make it so the actual behavior and TS bindings match what is in our docs.

@vkarpov15 vkarpov15 added this to the 6.2.0 milestone Dec 30, 2021
@vkarpov15 vkarpov15 merged commit 7c31dc8 into Automattic:6.2 Dec 30, 2021
@AbdelrahmanHafez AbdelrahmanHafez deleted the gh-11138 branch December 31, 2021 09:18
@Maximusya
Copy link

https://mongoosejs.com/docs/migrating_to_6.html is still missing this breaking change.
Though it hit us not when migrating from 5 to 6(.1), but when migrating from 6.1 to 6.2

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.

Model.exists() returns a promise and resolves to a boolean
5 participants