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

add mongoose default option to set returnOriginal #9189

Merged
merged 12 commits into from Jul 19, 2020

Conversation

AbdelrahmanHafez
Copy link
Collaborator

fixes #9183

Also made a typo fix in the docs for findOneAndReplace

@AbdelrahmanHafez AbdelrahmanHafez changed the title add mongoose default option to set defaultNewOnFindAndUpdate add mongoose default option to set defaultNewOnFindAndUpdateOrReplace Jul 2, 2020
lib/index.js Outdated Show resolved Hide resolved
@AbdelrahmanHafez AbdelrahmanHafez changed the title add mongoose default option to set defaultNewOnFindAndUpdateOrReplace add mongoose default option to set returnOriginal Jul 3, 2020
lib/query.js Outdated

const returnOriginal = get(this, 'model.base.options.returnOriginal');
if (options.new == null && returnOriginal != null) {
options.new = !returnOriginal;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd recommend setting options.returnOriginal = returnOriginal for consistency's sake. We convert new to returnOriginal under the hood anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds reasonable, I'll take a look at those changes in the next weekend, we can move this to 5.10.1 if it will delay things.

test/model.test.js Show resolved Hide resolved
@vkarpov15 vkarpov15 added this to the 5.10 milestone Jul 19, 2020
@vkarpov15 vkarpov15 merged commit c889778 into Automattic:5.10 Jul 19, 2020
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