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
Conversation
this also changes option name defaultNewOnFindAndUpdate -> defaultNewOnFindAndUpdateOrReplace
defaultNewOnFindAndUpdate
defaultNewOnFindAndUpdateOrReplace
defaultNewOnFindAndUpdateOrReplace
returnOriginal
lib/query.js
Outdated
|
||
const returnOriginal = get(this, 'model.base.options.returnOriginal'); | ||
if (options.new == null && returnOriginal != null) { | ||
options.new = !returnOriginal; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…, and link to `findOneAndUpdate()` tutorial
fixes #9183
Also made a typo fix in the docs for
findOneAndReplace