Skip to content

Commit 0596f55

Browse files
committed
fix: add missing file
1 parent df1c720 commit 0596f55

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
return;
16+
}
17+
18+
const level = get(schema, 'options.readConcern.level', null);
19+
if (level != null) {
20+
options.readConcern = { level };
21+
}
22+
};

0 commit comments

Comments
 (0)