Skip to content

Commit

Permalink
fix: add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed May 8, 2024
1 parent df1c720 commit 0596f55
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/helpers/schema/applyReadConcern.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

const get = require('../get');

module.exports = function applyReadConcern(schema, options) {
if (options.readConcern !== undefined) {
return;
}

// Don't apply default read concern to operations in transactions,
// because you shouldn't set read concern on individual operations
// within a transaction.
// See: https://www.mongodb.com/docs/manual/reference/read-concern/
if (options && options.session && options.session.transaction) {
return;
}

const level = get(schema, 'options.readConcern.level', null);
if (level != null) {
options.readConcern = { level };
}
};

0 comments on commit 0596f55

Please sign in to comment.