Skip to content

Commit

Permalink
fix(txns): omit writeConcern when in a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Apr 18, 2018
1 parent 5c2d12c commit b88c938
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,15 @@ function applyWriteConcern(target, sources, options) {
const db = sources.db;
const coll = sources.collection;

if (options.session && options.session.inTransaction()) {
// writeConcern is not allowed within a multi-statement transaction
if (target.writeConcern) {
delete target.writeConcern;
}

return target;
}

// NOTE: there is probably a much better place for this
if (db && db.s.options.retryWrites) {
target.retryWrites = true;
Expand Down

0 comments on commit b88c938

Please sign in to comment.