Skip to content

Commit 0c3fd9d

Browse files
committed
Fix invalid error message on hint with unacknowledged write
1 parent b8b765b commit 0c3fd9d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/operations/update.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,16 @@ export class UpdateOperation extends CommandOperation<Document> {
125125
const unacknowledgedWrite = this.writeConcern && this.writeConcern.w === 0;
126126
if (unacknowledgedWrite || maxWireVersion(server) < 5) {
127127
if (this.statements.find((o: Document) => o.hint)) {
128-
callback(new MongoCompatibilityError(`Servers < 3.4 do not support hint on update`));
128+
if (maxWireVersion(server) < 5) {
129+
callback(new MongoCompatibilityError(`Servers < 3.4 do not support hint on update`));
130+
} else {
131+
// TODO: https://jira.mongodb.org/browse/NODE-3541
132+
callback(
133+
new MongoCompatibilityError(
134+
`This Node.js driver do not support hint together with unacknowledged writes`
135+
)
136+
);
137+
}
129138
return;
130139
}
131140
}

0 commit comments

Comments
 (0)