Skip to content

Commit 34d56d7

Browse files
mbroadstdaprahamian
authored andcommitted
refactor: reuse commandSupportsReadConcern for now
1 parent 28ca63a commit 34d56d7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/core/sessions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,5 +736,6 @@ module.exports = {
736736
ServerSessionPool,
737737
TxnState,
738738
applySession,
739-
updateSessionFromResponse
739+
updateSessionFromResponse,
740+
commandSupportsReadConcern
740741
};

lib/operations/command_v2.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const resolveReadPreference = require('../utils').resolveReadPreference;
66
const ReadConcern = require('../read_concern');
77
const WriteConcern = require('../write_concern');
88
const maxWireVersion = require('../core/utils').maxWireVersion;
9+
const commandSupportsReadConcern = require('../core/sessions').commandSupportsReadConcern;
910

1011
class CommandOperationV2 extends OperationBase {
1112
constructor(parent, options) {
@@ -37,7 +38,7 @@ class CommandOperationV2 extends OperationBase {
3738
const serverWireVersion = maxWireVersion(server);
3839
const inTransaction = this.session && this.session.inTransaction();
3940

40-
if (this.readConcern && this.hasAspect(Aspect.READ_OPERATION) && !inTransaction) {
41+
if (this.readConcern && commandSupportsReadConcern(cmd) && !inTransaction) {
4142
Object.assign(cmd, { readConcern: this.readConcern });
4243
}
4344

0 commit comments

Comments
 (0)