Skip to content

Commit

Permalink
Fix bug with writeConcern.w option
Browse files Browse the repository at this point in the history
Try to fix Automattic#11300
  • Loading branch information
ekorolevanyrun authored Jan 31, 2022
1 parent 1a6eca8 commit ec6f579
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Model.prototype.$__save = function(options, callback) {
});
}
let numAffected = 0;
if (get(options, 'safe.w') !== 0 && get(options, 'w') !== 0) {
if (get(options, 'safe.w') !== 0 && get(options, 'w') !== 0 && get(options, 'writeConcern.w') !== 0) {
// Skip checking if write succeeded if writeConcern is set to
// unacknowledged writes, because otherwise `numAffected` will always be 0
if (result != null) {
Expand Down

0 comments on commit ec6f579

Please sign in to comment.