We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df1c720 commit 0596f55Copy full SHA for 0596f55
lib/helpers/schema/applyReadConcern.js
@@ -0,0 +1,22 @@
1
+'use strict';
2
+
3
+const get = require('../get');
4
5
+module.exports = function applyReadConcern(schema, options) {
6
+ if (options.readConcern !== undefined) {
7
+ return;
8
+ }
9
10
+ // Don't apply default read concern to operations in transactions,
11
+ // because you shouldn't set read concern on individual operations
12
+ // within a transaction.
13
+ // See: https://www.mongodb.com/docs/manual/reference/read-concern/
14
+ if (options && options.session && options.session.transaction) {
15
16
17
18
+ const level = get(schema, 'options.readConcern.level', null);
19
+ if (level != null) {
20
+ options.readConcern = { level };
21
22
+};
0 commit comments